Re: [CentOS] sed a particular line in file

2010-04-10 Thread Tom Brown
> % cat foo > Hello line 1 > Hello line 2 > Hello line 3 > > # To change just line 2 > % sed '2s/Hello/There/' > Hello line 1 > There line 2 > Hello line 3 > > # To change line 2 and onwards > % sed '2,$s/Hello/There/' > Hello line 1 > There line 2 > There line 3 > > It's that simple :-) > > y

Re: [CentOS] sed a particular line in file

2010-04-09 Thread Stephen Harris
> I thought i could use sed to change a particular line number but i dont see > that in the man page, i am trying to change a value from line number 6 % cat foo Hello line 1 Hello line 2 Hello line 3 # To change just line 2 % sed '2s/Hello/There/' Hello line 1 There line 2 Hello line 3 # To chan

[CentOS] sed a particular line in file

2010-04-09 Thread Tom Brown
I need to change a value in a file, but this line occurs more than once in this file therefore as i know the line number this value appears on how can i change that? I thought i could use sed to change a particular line number but i dont see that in the man page, i am trying to change a value from