can grep help me ?
i want to print lines from a file ABC.log .
lines which starts with words "2008-05-21" and ends with words "2008-05-21" I want to print all lines in between . How ? whats the command ? can grep help me ? |
You might use the address range feature of SED. For example:
sed -n '/patt1/,/patt2/p' filename This prints lines, beginning with the one containing patt1, and ending with the one containing patt2. Quote:
Note that the address range syntax may get confused when the beginning and ending patterns are the same. For good tutorials on BASH in general: http://tldp.org Excellent tutorials on many things, including SED and AWK: http://www.grymoire.com/Unix |
an 'awk' script would probably be the simplest solution - throw away lines until you get the one you want, then print lines until you get the last line you want
optionally you can play with the shell's assignment, looping, and pattern matching features The only way to learn is to read the 'bash' manual and play around - have fun. :) |
All times are GMT -5. The time now is 08:50 PM. |