I have the following .awk script:
-----
#!/usr/bin/gawk -f

BEGIN { FS = "|" }
  { print $1 > "names.txt"
    print $2 > "addrs.txt" }
-----

and this test file (mwe.txt):
-----
Alice|[email protected] Bob|[email protected]
Carol|[email protected]
-----

Running the script on this data file throws an error immediately after the
field separator:

$ gawk -f mwe.txt gawk: mwe.txt:1: Alice|[email protected]
gawk: mwe.txt:1:       ^ syntax error
gawk: mwe.txt:2: Bob|[email protected]
gawk: mwe.txt:2:     ^ syntax error
gawk: mwe.txt:3: Carol|[email protected]
gawk: mwe.txt:3:       ^ syntax error

What have I done incorrectly?

TIA,

Rich

Reply via email to