Help With RegExp.. Somedata +....+ Somedata
Hi All I am trying to parse a logfile to get the data from StringA to StringB with all the data in between..the data between StringA and StringB spreads over multiple lines example..
StringA .data data data data data ..StringB I am trying : cat /usr/local/mylog.log | grep -E 'StringA.*StringB' Should I use SED..? Can any provide me with an example ? Thx for any help |
Hi,
Something like this should work: sed -n '/StringA/,/StringB/p' infile The above will only print what's between StringA and StringB (both are included in output). You can use regular expressions for line ranges in sed. Instead of the 'standard' 1,4 (print lines 1 to 4) you can do /xxx/,/yyy/ where xxx and yyy are reg. expr. You can also combine them (1,/zzz/). Hope this helps. |
All times are GMT -5. The time now is 05:52 PM. |