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

awk help

Status
Not open for further replies.

Murugs

Technical User
Jun 24, 2002
549
US
Hello

IDS 1 2 5 6 11 12 15
IDS 23 49 50 79 80 81 82
IDS 98 99 100 101 102

From the above format of numbers
I need to get

a1 = 1
a2 = 2
a3 = 5
a4 = 6 and so on.
Is it possible using awk. ?

Thanks in advance
MP
 
depending on your definition of ".. and so on"

#-------------------------------------

BEGIN { count=1 }
{
for(i=2; i <= NF; i++)
printf(&quot;a%d = %s\n&quot;, count++, $i);
}


#----- OR --------------------

{
for(i=2; i <= NF; i++)
printf(&quot;a%d = %s\n&quot;, i-1, $i);
}
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top