Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Wildcatlg

    Passing a variable to awk/gawk

    putting schema_entries=$( awk -v var="$get_schema" -v var2="$cmd_arg" '$0 ~ var{ print $'var2' }' at the bottom works but its hard to believe there isnt a command to reeval the variable without redefining it
  2. Wildcatlg

    Passing a variable to awk/gawk

    arg well i still have one more problem while implementing this.... i cant get the shell to re-eval the variable. i have 3 variables get_schema=$( awk -v var="$1" '$0 ~ var{ print $2 }' databases.txt ) cmd_arg=2 schema_entries=$( awk -v var="$get_schema" -v var2="$cmd_arg" '$0 ~ var{ print...
  3. Wildcatlg

    Passing a variable to awk/gawk

    Aweosme i appreciate it. I think i get it now i really appreciate you taking the time to explain it. The new info will help out greatly.
  4. Wildcatlg

    Passing a variable to awk/gawk

    Basically to give you an over view. the $my_awk script is something ill use ALOT in my script because it simply reads a file that has 2 columns. Column 1 is the database name. Column 2 is the schema file assosiated with it so now instead of rewritting that script everytime i need the schema file...
  5. Wildcatlg

    Passing a variable to awk/gawk

    $my_awk is a variable script that is defined by the argument im trying to write and you freaken brilliant. this little piece of code has been driving me crazy for about 2 days. Ok next quest is can you explain maybe why you have to put it in the $(......) to get it to idetify the line of code...
  6. Wildcatlg

    Passing a variable to awk/gawk

    #!/bin/sh #Section: 04 #Name: Scott Deese my_awk="awk -v var=$1 ' /$var/ { print \$2 } ' " echo $my_awk schemas=`$my_awk database.txt` ive tried this many different ways and this was the last way describe by my teacher that doesnt work. I need to pass a variable from the sh shell to awk. the...

Part and Inventory Search

Back
Top