6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CSV を解析する

Last updated at Posted at 2013-02-01
data.csv
1111,1122,1133
2211,2222,2233
3311,3322,3333
4411,4422,4433
# !/bin/sh

for record in `cat data.csv`; do
     echo "${record}" | nawk -F , '{print "1列目:" $1 "3列目:" $3}'
done
実行結果
1列目:1111 3列目:1133
1列目:2211 3列目:2233
1列目:3311 3列目:3333
1列目:4411 3列目:4433

 ↓
そもそもループなんて要りませんでしたー

nawk -F , '{print "1列目:" $1 "3列目:" $3}' data.csv

awk歴一日の初心者が語るawk理解のポイント - 睡眠不足?!

6
6
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?