sort_dataset.sh 320 Bytes
Newer Older
1 2
#!/bin/bash

3
#      | sort by number of nodes (equivalent to number of "{"), remove duplicates
4 5
# cat $1 | perl -F{ -lane 'print "$#F $_"' | sort -n | cut -d' ' -f2- > "${1%.bracket}_sorted.bracket"
cat $1 | awk '{print gsub("{","{")-gsub("\\\\{","\\{"), $0}' | sort -n  | cut -d' ' -f2- > "${1%.bracket}_sorted.bracket"