Will this work? ------------------------------------------------------ #!/usr/bin/ksh THINGY=0 cat swt | sed 's/:/ /' | while read A B JUNK; do
if [ $THINGY -eq 1 ]; then B="that" THINGY=0 else THINGY=1 fi echo "$A:$B $JUNK" done ------------------------------------------------------ You can set up a similar loop in awk too. The sed 's/:/ /' changes the colon to a space so that the read A B JUNK will work. > -----Original Message----- > > Hi List > I need some help on this; > How do i replace the 2nd,4th,6th occurances of a column > (vertical) in a > file. > I know sed does it within a row > > $ cat swt > 01:this is a file1 this > 02:this is a file1 this > 03:this is line3 > 04:this is line4 > > $ sed 's/this/that/2' swt > 01:this is a file1 that > 02:this is a file1 that > 03:this is line3 > 04:this is line4 > $ sed 's/this/that/1' swt > 01:that is a file1 this > 02:that is a file1 this > 03:that is line3 > 04:that is line4 > > But i want > 01:this is a file1 this > 02:that is a file1 this > 03:this is line3 > 04:that is line4 > > I tried awk but awk seems to be going one line at a time. > > Thanks in Advance. > > GovindanK > > -- > http://www.fastmail.fm - The professional email service > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.net > -- > Author: GovindanK > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 http://www.fatcity.com > San Diego, California -- Mailing list and web hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). > -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: <[EMAIL PROTECTED] INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).