The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-13-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
Replace specific columns

hi All,

Thi sis very urgent.

I have large files with pipe delimited.
For example:
1.txt
1001024|120|9|-0.0|#|
1001025|120|9|#|
1001026|120|9|#|
1001032|120|2|-0.0|#|
1002026|110|9|#|
1002027|110|9|-0.0|#|
1002028|120|1|1.0|#|

I need to replace the 4th filed if it is # by |-|
my final txt file should like like below;

2.txt (out put)
1001024|120|9|-0.0|#|
1001025|120|9|-|
1001026|120|9|-|
1001032|120|2|-0.0|#|
1002026|110|9|-|
1002027|110|9|-0.0|#|
1002028|120|1|1.0|#|

Please help
Thanks in advance
JS