[TriLUG] Need some help parsing a file

Peter Neilson neilson at windstream.net
Sun Dec 29 21:22:00 EST 2013


sed s/.......................................// <old >new

Each "." represents ANY character. There are just enough of them to match  
all of your format, assuming that the column orientation is strict.

If your material is more complicated than that, the command will be  
slightly hairier.


On Sun, 29 Dec 2013 21:04:16 -0500, Brian Blater <brb.lists at gmail.com>  
wrote:

> This has never been my forte and just can't seem to figure out what I  
> need
> to do.
>
> I've got a file that basically has a directory listing. I need to parse  
> out
> everything but the filenames. The format of the document is basically  
> like
> this:
>
> 11/09/2013  11:49 AM         7,887,098 this is filename 1.txt
> 11/05/2013  08:09 PM        11,652,690 this is filename 2.sh
>
> Basically I need to strip the date, time and bytes and just leave the
> filename. Filenames will have spaces and various characters, but it is
> always after the bytes and spaces are what separate everything.
>
> This is on an UbuntuStudio 12.04 box.
>
> I figure I could do something with sed or awk or similar, but I just  
> don't
> have a good understanding of them and my google searches did not prove
> helpful (probably not using the right terms in the search).
>
> Any help would be appreciated.
>
> Thanks,
>
> Brian


More information about the TriLUG mailing list