For Programmers: Free Programming Magazines  


Home > Archive > AWK > October 2006 > Re: Matching variable date not working









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Matching variable date not working
Chris F.A. Johnson

2006-10-30, 7:01 pm

On 2006-10-27, Gianluca wrote:
> Hello all,
>
> have to match in a file field $1 that contains a date. I run:
>
> #!/bin/bash
> Thu=$(date --date="last thursday" +%d/%m/%Y)
> cat myfile | gawk -v thu=$Thu -f awkscript.awk


UUOC.

gawk -v thu=$Thu -f awkscript.awk myfile

> exit 0
>
>
> awkscript.awk:
>
> $1 ~ thu { matchvar++ }
> END { print matchvar }
>
>
> All seems not matching! Is this an error?


What is the format of the input?

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com