テキストファイルがあり、欲しいこの行を削除...最初に
grepを使ってみましたが、うまくいきません。
grep -v '^#'
ご提案いただきありがとうございます。
\n
OG0018658
M0~bbe9a2ca8a9915aafa220a87c248a064 | M1~439516e2a637051372399975c71af47b | 0.009414**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M5~d51f0107310c1d9a8cbe5b0305c46986 | 0.009341**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M6~462cfd85f3d26c451e0ea388b1ee265e | 0.009341**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M7~f3c7a863e871762d7674e5a6f6aa1b0d | 0.009438**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M8a~17a2f94c77ce46d91db4dc8a50d30fd7 | 0.034070*
* Average omega for all tree: 0.167
* Average omega for all tree: 0.179
* Sites significantly caracterized
* Average omega for all tree: 0.179
* Sites significantly caracterized
* Average omega for all tree: 0.176
* Sites significantly caracterized
* Average omega for all tree: nan
* Average omega for all tree: 0.175
* Average omega for all tree: 0.175
* Average omega for all tree: 0.174
* Average omega for all tree: 0.174
* Average omega for all tree: 0.177
* Average omega for all tree: 0.167
* Average omega for all tree: 0.179
* Average omega for all tree: 0.179
* Average omega for all tree: 0.176
* Average omega for all tree: nan
* Average omega for all tree: 0.175
* Average omega for all tree: 0.175
* Average omega for all tree: 0.174
* Average omega for all tree: 0.174
* Average omega for all tree: 0.177
Modified file
\n
OG0018658
M0~bbe9a2ca8a9915aafa220a87c248a064 | M1~439516e2a637051372399975c71af47b | 0.009414**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M5~d51f0107310c1d9a8cbe5b0305c46986 | 0.009341**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M6~462cfd85f3d26c451e0ea388b1ee265e | 0.009341**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M7~f3c7a863e871762d7674e5a6f6aa1b0d | 0.009438**
M0~bbe9a2ca8a9915aafa220a87c248a064 | M8a~17a2f94c77ce46d91db4dc8a50d30fd7 | 0.034070*
答え1
シンプルなawkソリューション:
awk '$1!="*"' infile
同等のsedソリューション:
sed '/^[[:blank:]]*\*/d' infile
grepで使用されているのと同じ正規表現:
grep -v '^[[:blank:]]*\*' infile
答え2
しかし、実際には空白文字で始まります。
grep -v '^[[:blank:]]*\*' file.txt