projectz

Tech, Gadgets, Photography, Social Media and Poor Spelling

Question: Is there a way of concatonating a file name in bash?

Rather useful bash technique for concatenating file names. 

~%
FILE=prog.tar.gz
~% echo ${FILE%%.*}
prog
~% echo ${FILE%.*}
prog
.tar
~% echo ${FILE#*.}
tar
.gz
~% echo ${FILE##*.}
gz

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on May 10, 2011 by in regular and tagged , , , .
%d bloggers like this: