User Tools

Site Tools


bash

bash programming tricks

extracting file extension

file="example.pdf"
file_extension=`echo $file | sed 's/.*\.//'`

removing file extension

file="example.pdf"
file_extension=`echo $file | sed 's/.*\.//'`
file_without_extension=`basename $file .$file_extension`
bash.txt · Last modified: 2011/11/08 15:59 by memeruiz