From: Joel VanderWerf Date: 2007-06-02T04:26:01+09:00 Subject: Re: parse text with ruby Ryan Davis wrote: > > On Jun 1, 2007, at 14:56 , kostas wrote: > >> I would like to parse this file with ruby, and to produce a new txt file >> where i have only ==> >> >> r 250 1006 -63 -65 91 -6 -8 319* >> r 250 1015 -52 -72 91 -6 -8 319* >> r 250 1019 -61 -83 92 -7 -8 319* > > Use the right tool(s) for the job: > > % cut -f 5 -d: x.txt | grep . | cut -c2- > r 250 1006 -63 -65 91 -6 -8 319* > r 250 1015 -52 -72 91 -6 -8 319* > r 250 1019 -61 -83 92 -7 -8 319* Who knows if that's going to work right if other output is mixed in? $ ruby -ne 'puts $1 if /Finished to read one line : (.*)/' x.txt r 250 1006 -63 -65 91 -6 -8 319* r 250 1015 -52 -72 91 -6 -8 319* r 250 1019 -61 -83 92 -7 -8 319* -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407