[Nottingham] Stripping lines out of a text file

Ted ted.marston at ntlworld.com
Fri Mar 14 17:09:43 GMT 2008


On Thu, 13 Mar 2008 at 16:20:03 +0000 Martin Garton wrote:
> On Thu, 2008-03-13 at 16:17 +0000, Martin Garton wrote:
> > On Thu, 2008-03-13 at 16:04 +0000, JJSH wrote:
> >
> > > "Size", "EDM", "Material", "Date", "Client".
> > >
> > > Can anyone think of a way I can strip out all of the lines that don't
> > > begin with one of the above, other than tediously going through it
> > > manually (some of the files are huge)? The remaining data needs to be
> > > kept in sequence.
> >
> > Something like:
> >
> > egrep "^((Size)|(EDM)|(Material)|(Date)|(Client))" file.txt
>
> or even:
>
> egrep "^(Size|EDM|Material|Date|Client)" file.txt

or even

egrep -v "^(Size|EDM|Material|Date|Client)" file.txt

if what you want is to omit those lines.

Ted.



More information about the Nottingham mailing list