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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I pass a variable into an AWK program

Status
Not open for further replies.

lauren

Programmer
Joined
Apr 6, 2000
Messages
1
Location
US
I want to retrieve a number from an external file and then pass this number into an awk script.  Within the awk script I want then to increment the variable by 10 each time an input record (from a different file) is processed.  This variable will assume the position of field 1 after awk processes the record.  Also how can I loop through the input file until the end of file is reached.
 
You can pass parameters to awk. you then manage it with ARGC and ARGV.
 
You can loop through the file using a for loop.<br><br>for A in `cat inputfile`<br>do<br>awk 'etc, etc, etc,<br>done <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top