[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible problem with gawk on linux

From: Mohit Parab
Subject: Possible problem with gawk on linux
Date: Mon, 30 Oct 2006 21:57:34 +0530

> Dear All,
>         The attached shell script creates a tempfile using gawk.  The problem 
> is as follows:
>       1)  The script searches for the string 'parab' in the file mohit.out 
> and prints it to "tempfile"
>       2)  Before printing any output to tempfile it initialises it using the 
> system commanf >tempfile.
>       3)  During the first pass the gawk program creates the tempfile 
> properly as an ASCII text.  However, on the subsequent passes it creates a 
> "data" file.  The same can be checked using the file command of Linux.
> Below are the details of the OS:
> /PROD_apps/runtime/release >uname -a
> Linux linux-test 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55 EDT 2005 i686 i686 
> i386 GNU/Linux
> Version of gawk
> /PROD_apps/runtime/release >gawk -W version
> GNU Awk 3.1.1
> Copyright (C) 1989, 1991-2002 Free Software Foundation.
> Please let me know in case your'll need any more information or if I am doing 
> anything incorrectly. 
> Foll. is the shell script
> /PROD_apps/runtime/release >cat sample_cut.sh
> cat $1|gawk 'BEGIN {my_flag=0}
> ($0 ~ /parab/) {
>         system(">tempfile");
>         print > "tempfile";
>         system("file tempfile");
> }'
> the data file is as follows:
> /PROD_apps/runtime/release >cat mohit.out
> mohit parab
> shamal parab
> kamlesh desai
> nilesh desai
> mimisha desai
> Regards,
> Mohit
This e-mail may contain Privileged/Confidential information and is
intended only for the individual(s) named. Please notify the sender, if
you have received this e-mail by mistake and delete it from your system.
Information in this message that do not relate to the official business of
the company shall be understood as neither given nor endorsed by it.
E-mail transmission cannot be guaranteed to be secure or error-free. The
sender does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version.
Visit us at www.kaleconsultants.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]