http://qs321.pair.com?node_id=180495


in reply to Manipulating Output

Abigail-II has the correct perl solution. However, if all you are doing is writing a very small perl program for that purpose alone, there's no need to re-invent the wheel.

cut -f 2 -d ':' data_file > output_file

Replies are listed 'Best First'.
Re: Manipulating Output
by Abigail-II (Bishop) on Jul 09, 2002 at 15:12 UTC
    Or a perl one-liner:
    perl -aF: -ple'$_=pop@F' in_file > out_file

    Abigail

Re: Re: Manipulating Output
by redsquirrel (Hermit) on Jul 09, 2002 at 15:12 UTC
    Here are a few ways to do it if you want to do it from the command line in Perl:
    perl -pe 's/[^:]+://' data_file > output_file perl -nle 'print /([^:]+)$/' data_file > output_file perl -nle 'print+(split /:/)[-1]' data_file > output_file
    TMTOWTDI,
    --Dave