I'm not well versed in awk, but you could use cut instead... command | grep bf1 | cut -d ' ' -f 1
...Or just use Perl # untested my @var = map {/^\w+/;$&} grep {/bf1/} `command`; > on the command line I get exactly what I > need, why doesn't this work during an > external call? Hmmm... my guess is the $1. The `` interpolates. You need to escape the dollar sign with a backslash... otherwise it puts the value of $1 into your command before executing it. You might want to use strict, it would have caught that. Rob -----Original Message----- From: Bill Akins [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 2:01 PM To: [EMAIL PROTECTED] Subject: Split on white space from `command` return? Hi! I would like to grab the first column (variable width) of data in each line that will be returned from an external command. I tried @PSARRAY = `command | grep bf1`; and got just the lines with data I wanted. The returned data looks like this: EHCFS001 Booted Down bf1/p20 Windows/MU Yes,Opt,0 12:55:29 VMDFS Booted Up bf1/p14 VM25AS21e16/MU Yes,Opt,0 12:52:12 ORA_1 Booted Up bf1/p18 VM25AS21e16/MU Yes,Opt,0 12:56:25 ps3 Booted Up bf1/p3 custom/MU Yes,Opt,0 12:51:56 ps4 Booted Up bf1/p4 custom/MU Yes,Opt,0 12:51:42 ps5 Booted Up bf1/p5 custom/MU Yes,Opt,0 12:51:22 I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5 in a var, array, hash, whatever and I don't care about any of the other data. A variable would be preferable over array, I think. I then tried @PSARRAY = `command | grep bf1 | awk -F " " '{print $1}'` but got the same exact results. Anyone know why it didn't like the awk command or just decided to ignore it? If I run command | grep bf1 | awk -F " " '{print $1}' on the command line I get exactly what I need, why doesn't this work during an external call? Running on Linux, Perl 5.6.1 Thanks all. Bill Akins SSS III Emory Healthcare (404) 712-2879 - Office 12674 - PIC [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]