Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

AWK oddity

Name: Anonymous 2011-02-26 20:36

For some reason this doesn't work
awk -f "$1" -F ":" -v value="$3" '($1 == value) {print $0}
But this does for some reason
cat "$1" | awk -F ":" -v value="$3" '($1 == value) {print $0}
Whenever I use the first one it gives a syntax error at each : and says that @ is an invalid char in the expression.

The file it's pointing to is a crappy plain text database of names, addresses, phone numbers and email addresses in that order and separated by colons.

I'd like to get the first one to work because the second one just looks silly to me.

Name: Anonymous 2011-02-26 20:45

Why the fuck didn't I read the man first?
Nevermind guys, this is now officially a waste of your time.

Name: Anonymous 2011-02-26 21:08

>>2
Nevermind
WTF!!
POST. THE. FUCKING. SOLUTION.

Name: Anonymous 2011-02-26 21:17

>>3
He passed the input file as a program file when he used the ``f'' flag. He should have used
awk -F ":" -v value="$3" '($1 == value) {print $0} # ... ' "$1"
instead.

Name: Anonymous 2011-02-26 21:33

>>3
The -f option specifies an awk script file, not the file that you're running an awk script on. To specify the file that you're running awk on, you just put the name of the file on at the end after the script

Name: Anonymous 2011-02-26 22:49

Another crude riddle solved by brave /prog/riders.

Name: Anonymous 2011-02-26 23:56

>>2
Why the fuck didn't I read the man first?
I LOVE YOU! I LOVE YOUR THREAD! I READ IT FIVE TIMES! KEEP POSTING!

Don't change these.
Name: Email:
Entire Thread Thread List