[Novalug] scripting
Jon LaBadie
novalugml at jgcomp.com
Mon Mar 2 16:19:19 EST 2009
On Mon, Mar 02, 2009 at 09:58:32PM +0100, Miguel Gonzlez Castaos wrote:
> Hi guys,
>
> I am trying to achieve a very simple thing.
>
> I am parsing a log file that has a bunch of lines like:
>
> Logically move media ID XU0479
> Logically move media ID XU0480
>
> to get the 5th word:
>
> more com_get* | grep Logically | awk '{print $5}' | sort > file
>
> However, I'd like to have those entries separated with spaces and no
> each entry in a different line. Any way to do that?
>
$ awk '
> /Logically/ {printf "%s ", $5}
> END { printf "\n" }
> ' com_get* > file
$
This leaves a space at the end of the line.
Let us know if that is a problem. Note, the
$ and > at the start of each line are standard
shell prompts, not something you type.
--
Jon H. LaBadie jon at jgcomp.com
JG Computing
12027 Creekbend Drive (703) 787-0884
Reston, VA 20194 (703) 787-0922 (fax)
More information about the Novalug
mailing list