Find the answer to your Linux question:
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 ...
  1. #1
    Just 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

  2. #2
    Linux 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

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2
    Yup that got it, thanks very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...