Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Manipulating Output

by ehdonhon (Curate)
on Jul 09, 2002 at 15:00 UTC ( #180495=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://180495]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-01-30 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?