awk tutorial confusion
- From: r <inpost@xxxxxxxxx>
- Date: Mon, 14 Apr 2008 01:53:41 -0700 (PDT)
Readers,
I am reading a tutorial, to learn how to use awk (http://
www.grymoire.com/Unix/Awk.html).
I've copied the following text and saved in the filenames shown:
fileowner:
#!/bin/sh
awk'
BEGIN {print"file\towner"}
{print $8,"\t",$3}
END {print "-done-"}
'
fileowner2:
#!/bin/sh
awk '
BEGIN { print "File\tOwner" }
{ print $8, "\t",
$3}
END { print "done"}
'
fileowner3:
#!/bin/sh
column=$1
awk '{print $column}'
Below is my various command terminal errors:
$ awk -f fileowner.awk
awk: fileowner.awk:2: awk'
awk: fileowner.awk:2: ^ invalid char ''' in expression
$ awk -f fileowner2
awk: fileowner2:2: awk '
awk: fileowner2:2: ^ invalid char ''' in expression
$ ls -l|Column 3
bash: Column: command not found
$ ls -l|fileowner3
bash: fileowner3: command not found
Regarding the fileowner file, I obtained the same error both when the
filename has no suffix and when the suffix is .awk. Subsequently I did
not use .awk farther. What am I doing wrong?
Yours,
gnu mandriva 2008
gnome 24
.
- Follow-Ups:
- Re: awk tutorial confusion
- From: Bruce Barnett
- Re: awk tutorial confusion
- From: Ed Morton
- Re: awk tutorial confusion
- From: Ed Morton
- Re: awk tutorial confusion
- Prev by Date: Spell Correct in Gawk (just 15 lines)
- Next by Date: Re: awk tutorial confusion
- Previous by thread: Spell Correct in Gawk (just 15 lines)
- Next by thread: Re: awk tutorial confusion
- Index(es):
Relevant Pages
|