#!/bin/tcsh -f
if ("$1" == '' || "$1" == "-help" || "$1" == "-h") then
   echo "Usage 1: A script to parse an filename"
   echo ""
   echo "   `basename $0` <name>"
   echo ""
   echo "Outputs the path, prefix and extension strings."
   echo ""
   goto END
endif

set anat_in = `echo "$1" | cut -d \[ -f1`
set bling = `echo "$1" | cut -d \[ -f2 | cut -d \] -f1`

set anat_path = $anat_in:h
if ( "$anat_path" == "${anat_in}" ) set anat_path = "."

set ana_name = $1:t
set ana_pref = $ana_name:r
set ana_ext = $ana_name:e

echo "$anat_path $ana_pref $ana_ext "

END:


syntax highlighted by Code2HTML, v. 0.9.1