Showing posts with label file name. Show all posts
Showing posts with label file name. Show all posts

Saturday, June 6, 2009

Trim Filename Extension

Trim Filename Extension

There is built-in functionality in Linux shell to trim extension of a file name.
${filename_env_var%.ext} --> note that dollar ($) sign in the beginning is NOT shell prompt.

Usage example:
$ filename=trace_20090606.txt
$ echo ${filename%.txt}
trace_20090606 --> this is the output of previous command