scripts/trees2NEXUS
raw| 1 | #! /bin/sh |
| 2 | # |
| 3 | # Convert one tree per line into PAUP (NEXUS) tree file |
| 4 | # Accepts input from named file(s) or standard input |
| 5 | # |
| 6 | echo "#NEXUS" |
| 7 | echo "" |
| 8 | echo "Begin Trees;" |
| 9 | if test $# -eq 0; then |
| 10 | egrep -n "." | sed -e 's/:/ = /' -e 's/^/ utree /' |
| 11 | else |
| 12 | i=0 |
| 13 | for file in $*; do |
| 14 | i=`expr $i + 1` |
| 15 | sed -e 's/^/ utree '"$i"' = /' $file |
| 16 | done |
| 17 | fi |
| 18 | echo "Endblock;" |