Revision 1 as of 2015-09-14 21:02:10

Clear message

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