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

Add a zero 1

Status
Not open for further replies.

frangac

Technical User
Feb 8, 2004
163
ZA
Hi All,

What I am looking for is when "AN=tolower(substr($1,1,15))" is declared (1123456789), I need to sub a zero in front of it which will result in 01123456789

Part of my script

}
for (e=1;e<NF;e++){if ($e~/P=67/)
{printf "%s %s %15s %s %s\n" ,Anum ,DATE, BNUM,DUR,$(e+1)
}
}
}' |
awk '{
hexstr="0123456789abcdef"
#newnum=tolower(substr($4,3,2) substr($4,1,2) substr($4,1,2))
newnum=tolower(substr($4,5,2) substr($4,3,2) substr($4,1,2))
YEAR=tolower(substr($2,1,2))
MONT=tolower(substr($2,3,2))
DAY=tolower(substr($2,5,2))
HOUR=tolower(substr($2,7,2))
MIN=tolower(substr($2,9,2))
SEC=tolower(substr($2,11,2))
#OPE=tolower(substr($5,1,6))
OPE=tolower(substr($5,5,2) substr($5,3,2) substr($5,1,2))
AN=substr($1,1,15)
#AN1=(gsub(AN,"^0AN",AN))


Many Thanks
Chris
 
AN = "0" AN

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi Vlad,

Simple !!!!!( stupid me)

Many Thanks
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top