Skip to content

Instantly share code, notes, and snippets.

@dliggat
Created January 10, 2014 14:40
Show Gist options
  • Save dliggat/8355304 to your computer and use it in GitHub Desktop.
Save dliggat/8355304 to your computer and use it in GitHub Desktop.
Count the length of genome strings in the fastas directory
#!/bin/bash
# the_fastas=`ls fastas | sort --reverse`
the_fastas=`ls fastas`
total=0
for file in $the_fastas; do
size=`cat "fastas/$file" | grep -v '>' | tr -d "\n" | wc -c`
echo "The file is $file with a size of $size"
total=$((total+size))
done
echo "The total length is $total"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment