LoginSignup
0
1

More than 5 years have passed since last update.

カンマを区切り文字として、各フィールドの値を抜き出す

Last updated at Posted at 2017-07-17

目的

カンマを区切り文字として、各フィールドの値を抜き出す
"aaa","bb,1b","ccc"

期待値
aaa
bb,1b
ccc

環境

CentOS 7

コード

echo '"aaa","bb,1b","ccc"' | awk -F'","' '{print $2}'

  • -F オプションを使用して、","をフィールド区切り文字に指定しています
  • awk が print $2 コマンドを実行すると、入力ファイルの各行の 2番目のフィールドが出力されます。つまり、bb,1bが出力されます。
0
1
0

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
0
1