Re: grep/sed help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, 2009-06-10 at 12:01 -0700, nate wrote:
> Joseph L. Casale wrote:
> 
> > if the text indented beneath it has "D:", then do the same and extract
> > "SNAPSHOT ID" if and only if "E:" follows?
> 
> If the line counts are constant you could do the reverse:
> 
> grep -B 3 "\(E:\|D:\)" input.txt  | grep Shadow

And being inherently lazy, I would do

  grep -B 3 "\([ED]:\)" input.txt ...<whatever else>

> 
> Which would show the 3 lines above a line that has E:\ or D:\ and
> then only display the lines with the word Shadow.
> 
> nate
> <snip>
-- 
Bill

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux