텍스트 파일이 있고 원하는이 줄 삭제... 처음에
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