help please

Yang Xiao yxiao2004 at gmail.com
Fri Aug 27 21:29:32 UTC 2004


On Thu, 26 Aug 2004 17:52:56 -0700 (PDT), Mr. Oberoi <oberoi_1 at yahoo.com> wrote:
> can some one tell me what is wrong with the following
> filter for squidlog. I am getting the following error
> ===================================================
> [oberoi at localhost uni]$ ./squidlogconverter.sh access
> -n
> access file exists
> number each line sequentially, begning from 1 by
> default
> numbering file...
> awk: cmd. line:1: %9d.%03d %d %d.%d.%d.%d %s/%03d %d
> %s %s %s %s%s/%s %s /n { print $3 "," $4}
> awk: cmd. line:1: ^ syntax error
> awk: cmd. line:1: %9d.%03d %d %d.%d.%d.%d %s/%03d %d
> %s %s %s %s%s/%s %s /n { print $3 "," $4}
> awk: cmd. line:1:               ^ syntax error
> awk: cmd. line:1: %9d.%03d %d %d.%d.%d.%d %s/%03d %d
> %s %s %s %s%s/%s %s /n { print $3 "," $4}
> awk: cmd. line:1:                            ^ syntax
> error
> awk: cmd. line:1: %9d.%03d %d %d.%d.%d.%d %s/%03d %d
> %s %s %s %s%s/%s %s /n { print $3 "," $4}
> awk: cmd. line:1:
>            ^ syntax error
> 
> =====================================================
> is there any good help available on awk or patterns i
> have been searching lots but nothing useful to create
> this filter
> "%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s"
> thanks
> 
> =====
> deepak oberoi
> 
Hi, 
looks like you need to surround the {print $3 ","  $4} with ' (single
quotes), like this:
'{print $3, "," $4)'

as for help,
try "Sed and Awk" by O'Reilly Assoc., it's a very good book on the
subject, and at the mean time, try man awk :P
I know it's tedious read, but it's actually pretty comprehensive.

Yang





More information about the users mailing list