The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 08-30-2007
iAm4Free iAm4Free is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 18
Quote:
Originally Posted by robotronic View Post
Actually, the single quotes are making the difference, not the double ones:

Code:
awk -F'|' '$1~/'"$1"'/{ code... }'
All the awk code is enclosed in single quotes, when you want to "break" the awk code because you need the value held by an external shell environment variable, you simply close your code with a quote and reopen it (with another quote) when you've finished the external variable evaluation.

Putting double quotes around a shell variable is only a good scripting practice (so you avoid possible problem with null values, etc...).
Thanks its very clear explanation!