http://www.perlmonks.org?node_id=525276


in reply to Re: repeat data at one line and grep as pre-set format
in thread repeat data at one line and grep as pre-set format

cat yourfile.txt | perl -ple 's/(\S+\s+\S+)\s+/$1\n/g'

Isn't that the same as:

perl -ple 's/(\S+\s+\S+)\s+/$1\n/g' yourfile.txt

UUOC.


Dave

Replies are listed 'Best First'.
Re^3: repeat data at one line and grep as pre-set format
by Random_Walk (Prior) on Jan 25, 2006 at 09:58 UTC

    You are right and your way is more efficient too. I wrote it with the cat file | as that is how I tested it with echo, just failed to engage my brain completely :-)

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!