Problem Piping iostat -c to awk!
Dan Nelson
dnelson at allantgroup.com
Fri Jul 15 04:03:17 GMT 2005
In the last episode (Jul 14), Hakim Singhji said:
>
> | iostat -c 300 1 | awk '!/[a-zA-Z]|^$/ {print $1}'
>
> This doesn't seem to work for me... awk tells me:
>
> awk syntax error at source line 1
> ***
> /[a: Event not found.
>
> Not sure how to allow awk to delete two top rows of iostat... other that
> the grep option -v. Does not seem to be working in awk.
You're probably running csh or tcsh, which try and interpret the !
character even in quotes. It'll work in a script, but on the
commandline you'll need to change it to \! . Alternatively, you can
print only lines with leading spaces followed by a number with:
iostat -c 300 1 | gawk '/^ +[0-9]/ {print $1}'
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list