[SWLUG] Awk is driving me MAD!

Justin Mitchell justin at discordia.org.uk
Wed Jun 11 10:34:54 UTC 2003


On Wed, 2003-06-11 at 11:11, Gareth James Powell wrote:
>  That makes it a lot shorter! :-) ...but does not work on the Sun[1]
> :-(  Thanks for trying anyway, it might be something very slightly
> different for the Sun but I'm not an awk whizz or have the books. I
> will give it a go on my Linux box later, which I suspect will like it
> ok.
> 
>  Given that this is a Linux forum y'a might as well say so what if the
> Sun won't run it? Who cares?...
If the [*nix] native version doesnt work, grab the source to the gnu
version and recompile it on for your system, as like many of these
things linux just ships with the generic gnu versions, theyre not linux
specific.

> [1] awk '!/^#/{ printf("%s IN A %s\n", $2, $1); }'  /etc/hosts 
>     /^#/{: Event not found

Thats a shell escaping issue, the ! should have been ignored by the
shell because it was inside quotes, but its obviously slightly borked,
so try adding a backslash infront of it to escape it.






More information about the Swlug mailing list