[SunHELP] awk help!


Wed Nov 20 08:28:01 CST 2002


excuse me, that'd be better as:

command | grep '|' | tr -d ' ' | awk <blah blah blah>

-----Original Message-----
From: Donaldson, Mark 
Sent: Wednesday, November 20, 2002 6:20 AM
To: 'Sangbutsarakum, Patai'; 'sunhelp at sunhelp.org'
Subject: RE: [SunHELP] awk help!


easiest way is to deal with it as a separate task

command | grep '|' | awk -F'|' '{print $1}' | tr -d ' '

not the prettiest but I assume it's a one-shot task.

-M

-----Original Message-----
From: Sangbutsarakum, Patai [mailto:patais at reach.com]
Sent: Wednesday, November 20, 2002 12:49 AM
To: 'sunhelp at sunhelp.org'
Subject: [SunHELP] awk help!


If I need to join output of command, filtered by awk
then concat them with variable of shell script.

Ex.

#!/bin/sh

read input
/path/to/command -v -d "$input" |grep '|' |awk '{ FS="|" }{ print
$1"\@"$input }'   
								^^^^^^^^^^
								|
								What I
stuck!                    
Ex.

assume $input from user is hello.world

==> /path/to/command -v -d "$input" | grep '|'
usera    |    1   |   2
userb    |    3   |   4
userc    |    5   |   6

==> |awk '{ FS="|" }
I got
usera^^^^
userb^^^^
userc^^^^

...(^ is space)....

what I need to be output is 
usera at hello.world
userb at hello.world
userc at hello.world

Hope this make sense
Thnks
Pat
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list