我有一个linux文件。在该文件中,有些行与数字和字母字符合并。我只想删除字母字符行。
$ cat file
###John Daggett King Road, Plymouth MA##
Alice Ford, 22 East Broadway, Richmond VA
Orville Thomas, 11345 Oak Bridge Road, Tulsa OK
#Terry Kalkas Lans Road, Beaver Falls PA
Eric Adams, 20 Post Road, Sudbury MA
##Hubert Sims,A Brook Road, Roanoke VA
Amy Wilde, 334 Bayshore Pkwy, Mountain View CA
Sal Carpenter, 73 6th Street, Boston MA
让我们考虑一个具有以下示例内容的文件:
仅删除#Terry Kalkas Lans Road,Beaver Falls PA这样的线条。我想看看
Amy Wilde, 334 Bayshore Pkwy, Mountain View CA
Sal Carpenter, 73 6th Street, Boston MA
请分享您的想法
最佳答案
您可以使用此sed
删除所有没有数字的行:
sed '/[0-9]/!d' file
Alice Ford, 22 East Broadway, Richmond VA
Orville Thomas, 11345 Oak Bridge Road, Tulsa OK
Eric Adams, 20 Post Road, Sudbury MA
Amy Wilde, 334 Bayshore Pkwy, Mountain View CA
Sal Carpenter, 73 6th Street, Boston MA