Unix/Linux Go Back    



best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

UNIX for Dummies Questions & Answers




Kindly Note - This is a Single User Post by Forum Member ygemici Regarding:
best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :).
Please Follow The Primary Link Above to View the Full Discussion.

   
Old Unix and Linux 08-26-2010
ygemici ygemici is offline Forum Advisor  
sed_shell@LNU
 
Join Date: Feb 2010
Last Activity: 26 April 2017, 8:59 AM EDT
Location: istanbul
Posts: 1,713
Thanks: 4
Thanked 295 Times in 286 Posts
Quote:
Originally Posted by scottn View Post
Hi.

I would (should) expect the same behaviour on AIX as I get on Solaris (but don't have access to it to try now). Perhaps the GNU sed is just too nice to us? Linux

This:

Code:
$ sed -n "$p" file1

is the same as

Code:
$ sed -n "" file1

if p is not set, as $p would be expanded by the shell (as a variable).

Try:

Code:
$ sed -n "$ p" file1

or

Code:
$ sed -n '$p' file1

(although it probably won't print anything on Solaris if there's no newline there!)
i think same you about gnu sed Linux

but these are all the same and also return null

Code:
$ sed -n "$ p" file1

or

Code:
$ sed -n '$p' file1

for this we can use like this Linux

Code:
# cat file1
1
2
3
4

trick this for me Linux

Code:
 
/usr/xpg4/bin/sed -n '$p' file1 2>/dev/null
4


Code:
/usr/xpg4/bin/sed "" file1 2>/dev/null
1
2
3
4

or


Code:
/usr/xpg4/bin/sed '' file1 2>/dev/null
1
2
3
4