how to delete the line if the first letter is a single digit

Hi,
I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line,
if it starts with 2 or more digits then i have to keep the line

Here is a sample of my file:

377 CARRER DE LA DIPUTACI�	BARCELONA	CATALUNYA	08013	ESP	
77 GREEN STREET	HIGH WYCOMBE	BUCKINGHAMSHIRE	HP11 2	GBR
2 KREUZWEG	ERSIGEN	BERN	3423	CHE	
3 MUNCHPLATZ	10. BEZIRK-FAVORITEN	WIEN	1100	AUT	

Here is what i want in my output file:

377 CARRER DE LA DIPUTACI�	BARCELONA	CATALUNYA	08013	ESP	
77 GREEN STREET	HIGH WYCOMBE	BUCKINGHAMSHIRE	HP11 2	GBR

I have tried the following regex:
sed -e /^[0-9]/d -- this is deleting all lines.

awk '/^[0-9]/ && length($1)<2 {next} {print} ' inputfile

using awk.

1 Like
grep -E '^[0-9]{2}' infile
sed '/^[0-9][0-9]/!d' infile
awk '/^[0-9]{2}/' infile

whitespace proof:

awk '$1~/[0-9]{2}/' infile1039

@ramky79: A little tweak to your attempt. Add space after [0-9] - "[0-9] ".

sed '/^[0-9] /d' inputfile

Using grep...

grep -v "^[0-9] " infile

--ahamed

Then use [ \t] , since otherwise this will not work if the whitespace happens to be tab:

sed '/^[0-9][ \t]/d' inputfile
grep -v "^[0-9][ \t]" infile

Or to make it also tolerant to whitespace at the beginning - like the last awk example - use ^[ \t]*[0-9][ \t]