且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除与&QUOT开始行; C"使用awk?

更新时间:2023-02-15 20:57:13

如果数据在文件的data.txt ,然后

使用 AWK

awk '!/^C/' data.txt

使用的grep

grep -v ^C data.txt 

不包括C的所有行的开始。

Display all lines without "C" at the start.

^ C 表示匹配字母C在开始行的。 在awk和 -v 在grep的否定匹配。

^C means to match letter "C" at start of line. ! in awk, and -v in grep negate the match.