[TriLUG] Need some help parsing a file

John Vaughters jvaughters04 at yahoo.com
Tue Dec 31 10:53:51 EST 2013


>Almost. Tom's ORIGINAL third line contains two tabs (\t or 011) in the  
>third line. Tabs got converted to spaces somewhere in the e-mail  
>processing. Doesn't work on that line if tabs are in place.



Peter, 

You are keeping me on my feet. Test file contains the tab. I will say the tab is an unlikely situation for this type of output.

 cat test | awk -F "[\040\011][,0-9]+[\040\011]" '{print $2}'


This works with tab or space. But I have to admit, now I am getting to the point that I like to stay away from and that is complicated REGEX that is confusing to many that do not use it.

Tom,

I do like your tr solution very much. Some super minimal embedded products do not have awk (very few), but do have tr. It's always good to have the classic unix solutions on hand for my job.

Thanks for sharing,

John Vaughters


More information about the TriLUG mailing list