Perl one-liner to print columns
- From: errinlarsen@xxxxxxxxxxx (Errin M HMMA/IT Larsen)
- Date: Mon, 25 Apr 2005 12:01:13 -0500
Hi Perlers,
I typically will type the following to collect a specific column of
data from some command's output:
# some_command | awk '{print $4}'
I wanted to start using perl one-liners more often, so I thought I'd
try the column thing first. This is what I came up with:
# some_command | perl -pe '$_ = (split)[3] . "\n";'
That feels/seems rather awkward. Is there an easier, "cleaner" way of
doing this?
--Errin
.
- Follow-Ups:
- Re: Perl one-liner to print columns
- From: Jay Savage
- Re: Perl one-liner to print columns
- Prev by Date: Re: How to add my own start method to existing HTML::Parser class to Scrape Screens?
- Next by Date: Re: Perl one-liner to print columns
- Previous by thread: Reading multi line input from user
- Next by thread: Re: Perl one-liner to print columns
- Index(es):