awk question

Polytropon freebsd at edvax.de
Thu Apr 9 07:10:50 PDT 2009


On Thu, 9 Apr 2009 15:32:51 +0200 (CEST), Oliver Fromme <olli at lurza.secnetix.de> wrote:
> If ";" is the delimiter character, you need to tell awk
> about it (i.e. use the -F option).  This one should work:
> 
> awk  -F';'  '$3 ~ /^[a-z]{5}$/ {print}'  file

You can even omit {print} because it's the default action
(to print the whole line, i. e. $0) when no action is given
for a pattern.

	% awk  -F';' '$3 ~ /^[a-z]{5}$/' file

When using this in a shell, keep an eye on eventually needed
quoting or escaping of $.


-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list