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

inserting variables within my awk statement 1

Status
Not open for further replies.

rigstars2

Instructor
Dec 18, 2011
64
US
Here is a snippet of my awk statement..I'm trying to insert these 2 variables in the statement but they are not getting evaluated. Can someone point me in the right direction?

ZONE=`date "+%Z %Y"`
DAY=`date "+%a"`

awk '{if (NR<2) {print "["$1, $2, $3"]"}}'

I'v tried this:

awk '{if (NR<2) {print "[" $DAY, $1, $2, $3, $ZONE "]"}}'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top