Hi my requirement is to split a varaible lenght record into fixed lenght records. What stage can accomplish this?
Input
Key,Col1,Col2,Col3,......... (can go up to 700 variable columns)
123,100001,100002,100003,100004
223,200001,200002,200003
323,300001,300002,300003,300004,300005
Desired output
Key,Col
123,100001
123,100002
123,100003
123,100004
223,200001
223,200002
223,200003
323,300001
323,300002
323,300003
323,300004
323,300005
What stage can acomplish splitting variable length recrods
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 26
- Joined: Wed Mar 17, 2010 11:05 am
Unix solution
Code: Select all
$ cat file
123,100001,100002,100003,100004
223,200001,200002,200003
323,300001,300002,300003,300004,300005
$ awk -F"," ' { for(i=2;i<=NF;++i){print $1","$i}} ' file
123,100001
123,100002
123,100003
123,100004
223,200001
223,200002
223,200003
323,300001
323,300002
323,300003
323,300004
323,300005
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 26
- Joined: Wed Mar 17, 2010 11:05 am