Chas. Owens wrote:
On Mon, Nov 10, 2008 at 21:40, Rob Dixon <[EMAIL PROTECTED]> wrote:
John W. Krahn wrote:
Why not just:

ipaddy=`awk '{ print $1 }' ipin.txt`

But that still doesn't get you a comma-separated list.
Erm, a Perl list?

Rob

Hey, if you throw an @ in front of ipaddy you get a Perl list.

But I think the answer that is really wanted is

ipaddy=$(perl -lne 'push @a, (split)[0];END {print join ",", @a}'
file_with_the_data);

Or:

ipaddy=$(perl -lane'[EMAIL PROTECTED],$F[0]}{$,=",";[EMAIL PROTECTED]' 
file_with_the_data);



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to