[Nottingham] Stripping lines out of a text file

Martin Garton martin at stupids.org
Thu Mar 13 16:17:59 GMT 2008

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

should give you what you need. (NB: not tested, and I seem to mess up
regexps most of the time these days)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20080313/618ff5b5/attachment.bin

More information about the Nottingham mailing list