Skip to content
Advertisement

Remove only Alphabetic Character lines in a linux file by using Sed/Awk

I have a linux file. In that file, some lines are there merge as with numeric and alpha charcters. I want to remove only alpha characters lines..

$ 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

Let us consider a file with the sample contents as below:

remove only #Terry Kalkas Lans Road, Beaver Falls PA kind of lines. I want to see

Amy Wilde, 334 Bayshore Pkwy, Mountain View CA

Sal Carpenter, 73 6th Street, Boston MA

Please share your Ideas

Advertisement

Answer

You can remove all lines that have no digit with this 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
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement