I'm trying to get the last substring before a non alphanumeric character. For eg.
1) beta gamma foo
2) beta gamma%foo
3) beta gamma|---foo
In all of the above examples I'm trying to get "foo" as it is the last substring after splitting on non-alphanumeric characters
So far I've tried
cat file* | awk -F'[^:alnum:]' '{print $NF;}' | less
but this doesn't give the expected results
Your POSIX regex is incorrect. Use this awk command:
awk -F '[^[:alnum:]]' '{print $NF}' file
foo
foo
foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With