Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
100,000 行のテーブルがあります。フォーマットは次のようになります。
abc '\t' gi| a b c d e
列 abc はタブで区切られ、他の列はスペースで区切られています。列 'gi|' を削除したい 他のすべての列を保持します。タブまたは | を使用してみました 私の区切り文字としてですが、うまくいきませんでした。何かご意見は?
awk のsub関数を使用できます。
sub
awk '{sub(/.*/,"",$2)}1' file
また
空の値を列 2 変数に代入するだけです。
awk '{$2=""}1' file
フィールドを単純に無視しないのはなぜですか?
sed 's/\t[^\t ]* /\t/' file
最初のタブの後のテキストをスペースまで削除します。