Re: Difference beetwen awk and gawk?



On 2007-12-04, Dawid Murga³a <murgala@xxxxxxxxx> wrote:


Hi,
I'm new to awk, I wrote a simple script using gawk, then change it to awk:

awk '/[0-9]+ [a-z0-9]+/{printf " \047%s\047)\n", $1 > "text.txt"}END{printf "END\n" > "test.txt"}' afile.dat

afile.dat :
123456 abc
111111 abcd

It works with gawk, but in awk returns an error:

.wk: 0602-533 Cannot find or open file afile.dat
The source line number is 1.
Syntax Error The source line is 1.


Any ideas? afile.dat has read rights.

Maybe when you converted your script from gawk to awk, you also
converted (or failed to convert) the line endings, and you get the error
message because there is no file named "afile.dat^M"
.



Relevant Pages

  • Re: Need help correcting this Bash function
    ... >> Why is it better to write a bash script than a script that runs ... machines that don't have bash or other more recent shells installed and, ... I do use gawk instead of old awk. ...
    (comp.unix.shell)
  • Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)
    ... You attempted to hijack my simple observation ("awk is the standard name, gawk ... I could also teach busybox awk to be called as "gawk", ...
    (Linux-Kernel)
  • Re: sed _s_gnu_alternatives_ (Re: [rft] (g)awk substitution)
    ... You attempted to hijack my simple observation ("awk is the standard name, gawk ... I could also teach busybox awk to be called as "gawk", ...
    (Linux-Kernel)
  • Re: Automatisierte TextVerarbeitung
    ... AWK - oder bessergesagt "awk" kam mir doch gleich irgendwie bekannt vor ... Einige kann man auch als exe fuer Windows beziehen ... Ich habe soeben ein altes mawk herausgekramt und ein mini-awk script, ... Betreff: Re: where are the binaries for GAWK? ...
    (microsoft.public.de.german.windowsxp.sonstiges)
  • Re: Editing text file
    ... I'd use gsar (general search and replace - ... or an awk of sed ... script. ... I'd actually do it with gawk: ...
    (comp.os.msdos.programmer)