bash shell

method 1

# get the base name of a file
f=twist_ip.fastq.gz
base=`basename $f .fastq.gz`
echo $base

method 2

More modern, and placing the file variable in quotes will survive files with spaces in the name.

# the modern way
f=twist_ip.fastq.gz
base=$(basename "$f" .fastq.gz)
echo $base

Bash (last edited 2015-09-14 21:02:43 by ChrisSeidel)