1
0

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.

1フィールド目のみダブルクォートを削除し出力

Last updated at Posted at 2017-06-02

半角スペース区切りの文字列に対し、
1フィールド目のみをダブルクォート削除し全体を出力
という処理について、
awkなりsedなりですぐ出来るだろうという印象を抱いたものの
よくよく考えてみるといまいちパッと手法が思いつかなかった。

そしてなんとなくで書いたのがこれ。

awk 'BEGIN{FS=" "}{gsub(/\"/,"",$1);for(i=1;i<=NF;i++)printf $i" " }' 

処理の内容の割りに長ったらしいように見えてしまう。
もうちょっと考えてみよう。。。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?