Skip to content

Instantly share code, notes, and snippets.

@tamanugi
Created July 24, 2017 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamanugi/5e01c6555cb7fa56c596ce0be91c6a55 to your computer and use it in GitHub Desktop.
Save tamanugi/5e01c6555cb7fa56c596ce0be91c6a55 to your computer and use it in GitHub Desktop.
fish-shellでcsv読み込み ref: http://qiita.com/tamanugi/items/62d4b69d0d1206128e85
for line in (cat syukujitsu_utf8.csv)
set -l syuku (string split , $line)
echo "$syuku[1]は$syuku[2]です"
end
$ fish csv_read.fish
国民の祝日月日は国民の祝日名称です
2016-01-01は元日です
2016-01-11は成人の日です
2016-02-11は建国記念の日です
2016-03-20は春分の日です
2016-04-29は昭和の日です
2016-05-03は憲法記念日です
2016-05-04はみどりの日です
2016-05-05はこどもの日です
2016-07-18は海の日です
....
while read -l line
set -l syuku (string split , $line)
echo "$syuku[1]は$syuku[2]です"
end < syukujitsu_utf8.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 2 columns, instead of 1. in line 9.
国民の祝日月日,国民の祝日名称
2016-01-01,元日
2016-01-11,成人の日
2016-02-11,建国記念の日
2016-03-20,春分の日
2016-04-29,昭和の日
2016-05-03,憲法記念日
2016-05-04,みどりの日
2016-05-05,こどもの日
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment