Darn, join(1) so nearly does this (for CSV files), but it won't do numeric sort order. If you can arrange to zero-pad the IDs, then that wouldn't be a problem:
Code:
Play,NEC,02,0000 22BF 3D4A
Pause,NEC,08,F43A 0000 2267
Select,NEC,13,0044 2283 1238
'cos then you could:
Code:
seq -f "%02.0f" 0 13 > seq.csv
join -a1 -t, -1 1 -2 3 -o auto seq.csv ~/src/codes.csv
and you'd get:
Code:
00,,,
01,,,
02,Play,NEC,0000 22BF 3D4A
03,,,
04,,,
05,,,
06,,,
07,,,
08,Pause,NEC,F43A 0000 2267
09,,,
10,,,
11,,,
12,,,
13,Select,NEC,0044 2283 1238
which is fairly nearly right...

Peter


Edited by peter (15/03/2012 15:18)
Edit Reason: discovered '-o auto'