|
Blue Forest http://www.lslnet.com at 11:18 on June 26, 2006
[Help] how to increase the number of lines in front of the designated trip?
I think in a designated version of the increased number of lines in front of a trip, how to realize the use sed or awk, or other bars, thank you for the guidance! ! |
[Help] how to increase the number of lines in front of the designated trip?
Benbanfa months to : oops : : oops : : oops : raising only known characters
Original documents as follows :
[code]# Cat grade.txt
M.Tans 5/99 Green 8 40 44 48311
9 24 26 48317 green J.Lulu 1998/1999
P.Bunny Yellow 12 35 28 02/99 48
07/99 12 26 26 4842 Brown-3 J.Troll
05/99 12 30 4712 Brown-2 L.Tansl 28[/code]
Now in his last trip air add two lines :
[code] # Awk '{gsub (/L.Tansl/ "\n\nL.Tansl") ($ }{print' grade.txt
M.Tans 5/99 Green 8 40 44 48311
9 24 26 48317 green J.Lulu 1998/1999
P.Bunny Yellow 12 35 28 02/99 48
07/99 12 26 26 4842 Brown-3 J.Troll
05/99 12 30 4712 Brown-2 L.Tansl 28[/code] |
[Help] how to increase the number of lines in front of the designated trip?
#!/bin/sed-F
4 i\
Insert this line before line 4.
Or,
#!/bin/sed-F
/specified-word/ I\
Insert this line before line contained specified-word. |
[Help] how to increase the number of lines in front of the designated trip?
-->
Oh, sed so convenient ah, I still want to do : oops : : oops : : oops : |
[Help] how to increase the number of lines in front of the designated trip?
Thank wingger and chenl! ! |
[Help] how to increase the number of lines in front of the designated trip?
Ed with more simple
[code]
Ed file<<!
4i
Some string
.
W
!
[/code] |
| |