I tried to do it myself with the following:
for i in $(grep something toprefix.log); do sed -i -e 's/^/prefix/' $i; done
First of all, apologies for the bone - I know this does not work!
Basically, I want to apply a prefix to matching lines in a log file using grep and sed or awk.
prefix-matching prefix-matching not-matching prefix-matching not-matching not-matching prefix-matching
Thanks in advance.
source share