How use reg expr to find substring up to indexOf string?

I have a bunch of files named “xxxx.idl”. I need to pull out the filename without the extension via regualr expression (in the above example, that would be “xxxx”). How do I do this?

Example:

File: “SomeFile.idl”
Result of Reg Expr: “SomeFile”

Must it be a reg expr or is that just another way to say what you want as output?

cd <dir-where-they-are>
for FILE in *.idl
do      echo "${FILE%.idl}"
done

There is no reg exp in this solution, just file name expansion and parameter value cutoff, so you may not be happy with this.

If you just need it for a script, you can simply…

ls *.idl | awk -F. '{print $1}'

That will list all files ending in .idl, then awk will output the first field using the period ‘.’ as the field separator. From there you can redirect the output wherever you wish. ie… to a file named ‘outputfile’ would be…

ls *.idl | awk -F. '{print $1}' > outputfile