Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
sed nightmare
Name: gildan2020 Date: March 20, 2003 at 05:33:11 Pacific OS: hp-ux CPU/Ram: multithreaded
Comment:
i hope i can explain dis correctly... i'm currently using sed to manipulate a file containing these types of contents: 23:16:14:14:455:66:14 (figure varies for every record in dat file)
the prob is some of those figures are the same. according to de above example, is there a way to change the value of 4th field without affecting the 3rd or 7th??
You can divide up the search expression using \( \) and then refer to the matching sections in the replace expression using \1 = first section, \2 = second etc:
sed 's/\([0-9]*:\)\([0-9]*:\)\([0-9]*:\)\([0-9]*\)\(..*$\)/\1\2\3new!\5/' test.lst
0
Response Number 3
Name: gildan2020 Date: March 20, 2003 at 22:03:49 Pacific
Summary: Greetings... I would be very thankful for any insight into this situation: It seems to me as though a text file I've received does not have a new line character at the end of it. The file is called 1...
Summary: I am trying to change a spacial character after I convert an ebcdic to ascii file. It has trouble with the special character so I need to change it to a ~. I am not sure if this is working properly. C...
Summary: Need help with awk or sed script. I have multiple files with the following in first line NUMBER_COLUMNS=15 I want to increase the number by 1 so it should say NUMBER_COLUMNS=16 Thanks ..... salman ...