Results 1 to 3 of 3
Hi everyone, newish to bash, and can't seem to figure out what the heck is going on with this one.
echo -n "Enter name to search for: "
read schnm
...
- 02-04-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 2
Bash and Awk problems
Hi everyone, newish to bash, and can't seem to figure out what the heck is going on with this one.
echo -n "Enter name to search for: "
read schnm
echo $(awk -F '-' /^"$schnm"/ "$filenm")
echo -n "Enter new gamertag: "
read ngmt
awk -F '-' "/^"$schnm"/ {$1 = "$ngmt"}" "$filenm"
awk: /^Jdizzle/ { = Joshozzle}
awk: ^ syntax error
Filenm is defined and exists, and entries exist in the form of
gamertag-gamerscore
Everything I read tells me that the field can be written to. Just, ehh I dunno. Any help would be greatly appreciated
- 02-04-2008 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Not sure what you're trying to achieve, but the syntax of your awk command isn't proper.
To use a shell variabele in awk you must use the -v option.
Check your awk documentation.
Regards
- 02-05-2008 #3Just Joined!
- Join Date
- Feb 2008
- Posts
- 2
Yup that got it, thanks very much


Reply With Quote