Date: Thu, 9 Apr 2009 16:10:28 +0200 From: Polytropon <freebsd@edvax.de> To: freebsd-questions@freebsd.org, lconrad@Go2France.com Cc: lconrad@Go2France.com, Oliver Fromme <olli@lurza.secnetix.de>, freebsd-questions@freebsd.org Subject: Re: awk question Message-ID: <20090409161028.cc669c2d.freebsd@edvax.de> In-Reply-To: <200904091332.n39DWpDs037047@lurza.secnetix.de> References: <200904082253.AA2466447562@mail.Go2France.com> <200904091332.n39DWpDs037047@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 9 Apr 2009 15:32:51 +0200 (CEST), Oliver Fromme <olli@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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090409161028.cc669c2d.freebsd>