terdon@tpad foo $ sort paths.txt | awk 'last && last == substr($0, 1, length(last)) { next; } { last = $0; print }'
/a/b
/a/e/f/g/h
/a/e/f/g/m/n/o
/a/e/f/g/m/n/p
terdon@tpad foo $ sort paths.txt | mawk 'last && last == substr($0, 1, length(last)) { next; } { last = $0; print }'
/a/b
/a/e/f/g/h
/a/e/f/g/m/n/o
/a/e/f/g/m/n/p
terdon@tpad foo $ sort paths.txt | nawk 'last && last == substr($0, 1, length(last)) { next; } { last = $0; print }'
/a/b
/a/e/f/g/h
/a/e/f/g/m/n/o
/a/e/f/g/m/n/p