Results 1 to 3 of 3
Hi guys,i need to put a certain word infront of 7 sentence after it match a certain word,for example
root:
hi how are u
i am fine
do u knw ...
- 10-22-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
Ways to start certain line with a word when it match a certain word?
Hi guys,i need to put a certain word infront of 7 sentence after it match a certain word,for example
root:
hi how are u
i am fine
do u knw me
nope i dont
nvm
now
u knw me
what i wanted is:
root:
root :hi how are u
root:i am fine
root:do u knw me
root:nope i dont
root:nvm
root:now
root:u knw me
ya is somehw like this,which mean when it match root,the next 7 sentences will need to start with "root:",can sed or awk do this?pls help out,thanks alot!!
- 10-22-2007 #2Code:
awk 'c&&c--{print "root:",$0;next};/root/{c=7}1' filename
- 10-23-2007 #3Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
hi thanks alot!i find out another way to do it le..thanks for your solution though


Reply With Quote