Originally posted by denevge
> cat test.awk
{
tekst = substr($0,7,4)
if ( tekst == "bla2" ) print $0
if ( tekst == "bla3" ) print $0
}
> awk -f test.awk test.txt
Hi Denevge,
Thanks a lot. The script works. But mine a little more complex and in the test.awk looks something like
{
tmpregion = substr( $0,21,10)
tmpyear = substr($0,14,4)
if ( tmpregion == "REGROLL " ) && (tmpyear > 1996) print $0
}
But when i try to execute awl from the command line it gives me the following error
bash-2.02$ awk -f test.awk test.txt > a
awk: test1.awk:4: if ( tmpregion == "REGROLL " ) && (tmpyear > 1996) print $
0
awk: test1.awk:4: ^ parse error
Please help me out with writing this script as it is the first time in my life I am writing one.
Thanks
Anurag
Appreciation is a wonderful thing;
It makes what is excellent in others belong to us as well.