[Wolves] Hello...

DragonMaster LUG at clews.homelinux.net
Mon Jun 15 10:01:07 UTC 2009


> adams at selenium:~$ ps ax | grep apache | grep -v grep | awk {'print $1'}
> 3933
> 11133
> 11135
> 11136
> 11138
> 11139
>
> Awk uses tabs as field separators, so I'm telling it to pull out the
> first one.
>

As a hint at the power of Awk, the above line can be shortened to be
  ps ax | awk '/apache/ {print $1}'

Awk also allows for some c-style commands like printf, so you are able to
format the output nicely as well.

Andy







More information about the Wolves mailing list