Script request

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Sun Apr 25 21:52:33 UTC 2004


On Sun, Apr 25, 2004 at 03:35:37PM -0400, Tony Pinto wrote:
> PMPART,PMPAR1,PMPAR2,PMPAR3,PMPAR4,PMPAR5
> 0000183209,000021032004,0000Q21032004,,,
> 0000493059,000049030504,,,,
> 0000670609,000067060004,0000Q67060006,,,
> 0000676609,0000Q67060006,,,,
> 0000833189,1510833189,,,,
> 0000833209,000071032004,(00007103209),,,
> 0000Q11030604,0000Q11030606,,,,
> 0000Q11030806,9005-3008,,,,
> 0000Q11040804,0000Q11040806,,,,
> 0000Q11041506,9005-4015,,,,
> 0000Q11050006,0000Q61050006,,,,
> 0000Q11051006,9005-4010,,,,
> 104222008A,104022008A,102121001A,102321001A,1560015150,1020021330

> Ouput :
> 
> 0000183209,000021032004
> 0000183209,0000Q21032004
> 0000493059,000049030504
> 0000670609,000067060004
> 0000670609,0000Q67060006

1.  while IFS=, read -a line ; do
	for i in ${line[@]:1} ; do
	    echo $line[0],$i
	done
    done

2.  IFS=", "
    while read line; do
	set -- $line
	printf "$1,%s\n" ${*:2}
    done

3.  awk -v FS=',+' '{for (i=2; i<NF; i++) print $1, $i}'

-- 
William Park, Open Geometry Consulting, <opengeometry-FFYn/CNdgSA at public.gmane.org>
Linux solution/training/migration, Thin-client
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list