1 #!/bin/sh 2 3 # shortens a path given from stdin 4 # usage: ./shortpath <long_path_to_be_shorten> 5 6 awk -F '/' '{if(NF > 4){print "…/"$(NF-2)"/"$(NF-1)"/"$(NF)}else{print}}' < /dev/stdin