I am trying to cleanup 7 or 10 digits numeric from the file. So for example :
Input :
3M Corporation
3M Inc. 888-356-8765
3M Inc. 356-8765
3M Inc. 3568765
3M Inc. 356-8765
3M 8883568765 Inc.
Output :
3M Corporation
3M Inc. - -
3M Inc. -
3M Inc.
3M Inc. -
3M Inc.
I need help in this issue as I am not able to check for 7 bytes or 10 bytes of numeric. Please advise.
The issue with this solution is it is also removing 2 or more numbers which I not want it. I only want to remove numbers if it 7 or mor bytes.
sed 's/\([0-9]\{2,\}\)/ /g;s/ / /g' number.dat
Input :
20M Corporation
3M Inc. 888-356-8765
3M Inc. 356-8765
3M Inc. 3568765
33M Inc.356-8765
3M 8883568765 Inc.
8883568765 3M Inc.
WACHOVIA/WELLS FARGO E2677-010
620 WEST 152ND STREET ASSOC LLC
AETNA NYC70 NY2
Output :
M Corporation
3M Inc. - -
3M Inc. -
3M Inc.
M Inc. -
3M Inc.
3M Inc.
WACHOVIA/WELLS FARGO E -
WEST 152ND STREET ASSOC LLC
AETNA NYC NY
Any help on this will be greatly appreciated as the code is working fine but cleaning out all numbers that are more than 1. I need it to be more than 7. Please advise.
$
$ cat number.dat
20M Corporation
3M Inc. 888-356-8765
3M Inc. 356-8765
3M Inc. 3568765
33M Inc.356-8765
3M 8883568765 Inc.
8883568765 3M Inc.
WACHOVIA/WELLS FARGO E2677-010
620 WEST 152ND STREET ASSOC LLC
AETNA NYC70 NY2
$
$
$ perl -lne 's/[\d-]{7,}//g; print' number.dat
20M Corporation
3M Inc.
3M Inc.
3M Inc.
33M Inc.
3M Inc.
3M Inc.
WACHOVIA/WELLS FARGO E
620 WEST 152ND STREET ASSOC LLC
AETNA NYC70 NY2
$
$