Separating Filename Components Use the following technique in tcsh scripts to extract components of a full pathname from a variable or parameter. The full pathname: % set fn="/Users/saruman/Documents/Essentials/todo.rtf" % echo $fn /Users/saruman/Documents/Essentials/todo.rtf Extract the pathname (head): % echo $fn:h /Users/saruman/Documents/Essentials Extract the filename (tail): % echo $fn:t todo.rtf Extract the extension: % echo $fn:e rtf Remove the extension: % echo $fn:r /Users/saruman/Documents/Essentials/todo To extract just the filename without the extension combine t and r: % echo $fn /Users/saruman/Documents/Essentials/todo.rtf % echo $fn:t:r todo You can change a filename using substitution: % echo $fn /Users/saruman/Documents/Essentials/todo.rtf % echo $fn:t:s/.rtf/.txt/ todo.txt