Re: SED help........
Ralph Crongeyer wrote:
I need some help with SED. I'm trying to insert a "command"/text at
the beginning of every line from one file and output to a new file
sed 's/.*/clamscan -ri -l /var/log/clamav/clamav-"$1".log
--move=/var/log/clamav/quarantine &/ /var/log/clamav/diff/diff.txt >
but sed givs me this error:
sed: -e expression #1, char 23: Unknown option to 's'
I have also tried to use the insert command i\ but it just inserts the
text on a new line above each of the lines read from the file instead
of just inserting the text at the beginning of each of the lines red
from the file?
Can someone help me with this?
It's difficult to tell exactly what your 2 expressions are. But I see
forward slashes (/'s) all over that. To use an s commad through sed is:
so if you have any "/" inside your expressions you need to escape them:
If you look at the error msg again "char 23: Unkown option", it's
picking your 3rd slash in char position 22 as the final / delimiter for
the s command.