Aug 5, 2002 #1 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
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
Aug 5, 2002 #2 vgersh99 Programmer Jul 27, 2000 2,146 US depending on your definition of ".. and so on" #------------------------------------- BEGIN { count=1 } { for(i=2; i <= NF; i++) printf("a%d = %s\n", count++, $i); } #----- OR -------------------- { for(i=2; i <= NF; i++) printf("a%d = %s\n", i-1, $i); } vlad +---------------------------+ |#include<disclaimer.h> | +---------------------------+ Upvote 0 Downvote
depending on your definition of ".. and so on" #------------------------------------- BEGIN { count=1 } { for(i=2; i <= NF; i++) printf("a%d = %s\n", count++, $i); } #----- OR -------------------- { for(i=2; i <= NF; i++) printf("a%d = %s\n", i-1, $i); } vlad +---------------------------+ |#include<disclaimer.h> | +---------------------------+