[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Awk, filtering match through external command

T o n g wrote:
> Any way to filter through external command to variable, somewhat like:
>  head /etc/group | awk '{print $0 | "cut -d':' -f1" | getline result ;}'

  looks like you want to assign the output of command to
a variable.

  in shell or bash use the backquote character `

result=`head /etc/group | cut -d: -f1`

example run:

me@ant(16)~$ result=`head /etc/group | cut -d: -f1`
me@ant(17)~$ echo $result
root daemon bin sys adm tty disk lp mail news


Reply to: