[Nottingham] Stripping lines out of a text file

James Dobson dob_3001 at yahoo.co.uk
Thu Mar 13 16:18:44 GMT 2008


cat foo | grep -e LALA -e MILK > data

where 'foo' is the file your searching and 
-e is the pattern (just keep adding -e for each
pattern)

and 'data' is the output put into a file

enjoy,

JD

--- JJSH <stellafan at jjsh.org> wrote:

> I've got a bunch of flat files here from an acient
> database that I need 
> to tidy up so that I can import them into MySQL. The
> first thing I need 
> to do is get rid of all the junk data that I don't
> need. All of the 
> needed data is contained on lines that begin with
> one of the following;
> 
> "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.
> 
> 
> TIA
> 
> John
> 
> _______________________________________________
> Nottingham mailing list
> Nottingham at mailman.lug.org.uk
>
https://mailman.lug.org.uk/mailman/listinfo/nottingham
> 



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the Nottingham mailing list