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

I have a nawk line... Is it possible to...

Status
Not open for further replies.

fsanchez13

Technical User
May 9, 2003
35
US
I have the following line in a script. Is it possbile to change the red text to an inputted variable? such as $1 an then type script variable??


nawk '/TIME/ {currtime=$2} /SECTION 12:/ {sec=$1" " $2" " $3" " $4} /SECTION 12:/ {print currtime " "sec} /TGNAME/,/S570-297271423/' 063003.txt > section12
 
'063003.txt' is outside awk and can manipulated by the calling shell/script.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Like :
mydatfile=063003.txt
nawk
'/TIME/ {currtime=$2} /SECTION 12:/ {sec=$1&quot; &quot; $2&quot; &quot; $3&quot; &quot; $4} /SECTION 12:/ {print currtime &quot; &quot;sec} /TGNAME/,/S570-297271423/'
$mydatfile > section12

HTH

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top