diff options
Diffstat (limited to 'challenge-110/stuart-little/lua/ch-2.lua')
| -rwxr-xr-x | challenge-110/stuart-little/lua/ch-2.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-110/stuart-little/lua/ch-2.lua b/challenge-110/stuart-little/lua/ch-2.lua new file mode 100755 index 0000000000..1527844266 --- /dev/null +++ b/challenge-110/stuart-little/lua/ch-2.lua @@ -0,0 +1,18 @@ +#!/usr/bin/env lua + +-- run <script> <file> + +local t={} +for l in io.lines(arg[1]) do + local lt = {} + for w in l:gmatch("[^,]+") do table.insert(lt,w) end + table.insert(t,lt) +end + +for i=1,#t[1] do + local col = {} + for j=1,#t do + table.insert(col,t[j][i]) + end + print(table.concat(col,",")) +end |
