Sed Issue....

Can someone help me "port" this to AIX sed?

 
sed  '/nas/{n;s/true/false/}'

I know it doesn't like the ; but i don't know how else to do it.... never had to sed on an AIX box :smiley:

Have you tried to place the commands on separate lines?

sed '/nas/{
n
s/true/false/
}'

Regards

Yea that works...........
However...... I kind of need it on a single line.....
Don't ask.... :smiley:

A similar solution in awk:

awk 'f{sub("true", "false");f--}/nas/{f++}1' 

Use nawk or /usr/xpg4/bin/awk on Solaris.

Regards

try this:

sed  '/nas/{n;s/true/false/;}'

Thats it!!!
Thanks vgersh99 ....
Care to explain the logic behind that? Just for my info...

Franklin..... Thanks... I was just working on it in awk...

'man sed' says:

     { command
     command
     }

     The { can be preceded with blank characters and can be  fol-
     lowed  with  white  space.  The  commands can be preceded by
     white space. The terminating } must be preceded by a NEWLINE
     character  and can be preceded or followed by <blank>s.  The
     braces may be preceded or followed by <blank>s. The  command
     may  be  preceded  by  <blank>s,  but may not be followed by
     <blank>s.

which means that the trailing 'action' should have a trailing 'terminator', i.e. ';'.

awesome..... thanks....
BTW... my man sed doesn't say that..... Go figure.....