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/p to o/p transition 1

Status
Not open for further replies.

mac3380

MIS
Sep 21, 2004
2
US
Hi,
i have an input file with the following:
A 1 0000 0187 PRX03
A 2 0188 0266 PRX03
A 3 0267 0439 PRX03
A 4 0440 0684 PRX03
B 1 0685 0749 PRX03
B 2 0750 0832 PRX03
B 3 0833 1029 PRX03
B 4 1030 1121 PRX03
i want to create the output lookup file like:

range splitstage
0000 A1
0001 A1
.
....
....
0188 A2
0189 A2
.
..
0267 A3


and so on..


that is the range value is continuous from 0000 to 9999 (which used to appear befor in the input file in the range; where as in the output al the values are stripped and each value is specified) the split stge value is taken from the interval of high and low range!

Please,advice on how to go abt this..im new to unix...but for this particulat instance im supposed to deliver in unix!!

Thank you
joseph
 
Something like this ?
awk '
{for(i=$3;i<=$4;++i)printf "%04d\t%s%s\n",i,$1,$2}
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
HI PHV,

I tried the command you had mentioned above ..but it didnt return any data..
do i have to specifically assign $1 to column1 and so on or does awk do it automatically,,...
i have never used awk command before and have done only a couple of basic scripts..please let me know if any additional preprocessing needs to be done for the above problem..
Ur time nad help is highy appreciated
thank you,
 
Can you please post the exact command you tried ?
Anyway, man awk

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top