Commit 739a838e authored by Mateusz Pawlik's avatar Mateusz Pawlik
Browse files

Fixed counting the right brackets for sorting.

parent 69b520c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
#!/bin/bash

#      | sort by number of nodes (equivalent to number of "{"), remove duplicates
cat $1 | perl -F{ -lane 'print "$#F $_"' | sort -n | cut -d' ' -f2- > "${1%.bracket}_sorted.bracket"
# 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"