Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'm kind of a linux newbie so please forgive any stupid questions or commenets.I'm trying to edit a text document using the sed command. I basically want to be able to go to a specific spot and change the data. The document looks similar to this:
row1: 39
row2: 49
row3: 85
etc....Just as an example, I'd like to go and change whatever is at the end of row3 to another number. So after the edition the document will look like this.
row1: 39
row2: 49
row3: 99
etc....I'd prefer to do this in userspace with the sed command but if anyone has a simplier way let me know.
The text may contain multiple instances of the same number other wise I could probably just do
sed -i 's/85$/99/' filename
That's about it. Any help is appreciated.
OJ

Have a look on IBM's developer works site, theres a good sed tutorial.
http://www-130.ibm.com/developerworks/
you'll have to register but it's free.

Hello,
Thanks for the replies.
I tried the follwoing like you suggested and it didn't work.
sed -e "/row3/s/:.*$/: 99/" inputfile > outputfile
It gives me this error:
sed: -e expression #1, char 16: Unterminated `s' commnad
OJ

![]() |
dual boot linux and win X...
|
Linux can use in internet...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |