We help IT Professionals succeed at work.

sed question

CyberGod
CyberGod asked
on
Medium Priority
303 Views
Last Modified: 2010-04-21
I want to replace a line in a file with sed, but without using -f option, I want to do it from the command line.
Comment
Watch Question

Commented:
the -f option just tells sed to get command from a specific file
you can do without by using simple


sed "s/somthing/simthingLong/g" inputfile>outfile
or
sed "s/somthing/simthingLong/g" inputfile
to spit changes to stdout

Commented:
You can put multiple sed expressions on the command line with the -e switch like this

sed -e 'sed-expression' -e 'sed-expression' inputfile >outputfile

It a good idea to put the quotes around the expressions in case one or more of them contains whitespace.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.