0

I want to remove lines with digits at the end of the string,

example of input:

example123
example
example12
example43

expected output:

example
3

Very simple to do:

awk '/[^0-9]$/ { print }' inputfile

Or, if you care to preserve empty lines,

awk '! /[0-9]$/ { print }' inputfile
1

Or in case you are interested in grep too, following simple grep may help also.

grep -v '[0-9]$'  Input_file
1
sed   -e    '/[0-9]$/d'    input-file.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.