Link to home
Start Free TrialLog in
Avatar of nngdemi
nngdemi

asked on

sed to add "me" at the end of line

Hi,
  I have a text file name file1 in /tmp/file1.  The content of the file
is:
test1 costs
test2 money
test3 deal

I like to use sed to look for test2
and add "me" at the end of the line:

so the output of the file1 above should
be:
test1 costs
test2 money me
test3 deal

thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of dirc
dirc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tel2
nngdemi,

An alternative (but very similar) solution would be:

sed "s/^test2.*/& me/" </tmp/file1 >/tmp/file1.tmp
mv /tmp/file1.tmp /tmp/file1
Avatar of nngdemi
nngdemi

ASKER

excellent.

Both work.

thanks.