How can I create a regular expression to match all files in the current directory that have only one period in their file name, and also not contain the string "abc" before the period?
It would match:
foo.txt
foobar.log
It would not match:
foo.bar.txt
abc.txt
I'm going to use this inside an if-statement in a ksh script, if that makes any difference.
That works wonderfully, thanks! In case anyone cares, here's the final code (with private details omitted), once put inside a for-loop and if-statement. Maybe not the best way, but it works...
for file in *; do
if [[ `echo $file | awk -F\. 'NF==2 && !/abc\./' | wc -l` -ge 1 ]]; then
#do something
fi
done