Filter lines that have only alphabets in first column

Using Perl:

# Match all lines that start with a-z or A-Z and are followed by a space
perl -ne 'print if m/^[a-z]+\s/i' file

Using awk:

# Match first field's that only contain a-z or A-Z
awk '$1 ~ /^[a-zA-Z]+$/' file

Both will output:

CABMEL  1873    1       1
CABMEL  1874    1       1
CABMEL  1875    1       1
CABMEL  1879    1       1
CABMEL  1884    1       1
CABMEL  1890    1       1
CABMEL  1899    1       1
CABMEL  1901    1       1
CABMEL  1903    3       2
CABMEL  1910    2       2
CABMEL  1912    1       1
CABMEL  1915    1       1
CABMEL  1926    2       2
CABMEL  1927    3       2
CABMEL  1928    4       2
CABMEL  1930    2       2

Leave a Comment