我有这个文字
which will be considered further in Chapter 6
Siannis et al., 2005
Crowther and Lambert, 2013a
Schumacher et al., 1994
2014
df=4
2005
2005
0, 1
4.1
我需要
which will be considered further in Chapter 6
Siannis et al., 2005
Crowther and Lambert, 2013a
Schumacher et al., 1994
df=4
我想删除那些没有单词的行。如果你能用 vim/grep/awk/cat 或其他工具来做这件事,欢迎。
答案1
您可以使用 grep 执行如下操作:
$ grep '[a-z]' text.txt
答案2
如果您正在寻找单词,请检查单词!
$ grep -w '[a-z]\+' file
which will be considered further in Chapter 6
Siannis et al., 2005
Crowther and Lambert, 2013a
Schumacher et al., 1994
df=4
[a-z]
这将打印包含至少 1 个字符长的字符块的行。