which node #-->node: /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz which node | cut -d':' -f1 #-->node which node | cut -d':' -f2 #--> /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz which node | cut -d':' -f3 #--> [[[[empty]]]] ################################### ### CHAINING CUT CALLS TOGETHER ### ################################### whereis node | cut -d':' -f2 | cut -d'/' -f2 #-->usr whereis node | cut -d':' -f2 | cut -d'/' -f2 #-->bin whereis node | cut -d':' -f2 | cut -d'/' -f2 #-->bin ## USING AS DELIMITER whereis node | cut -d':' -f2 | cut -d' ' -f2 #-->/usr/bin/node whereis node | cut -d':' -f2 | cut -d' ' -f3 #-->/usr/bin/x11/node whereis node | cut -d':' -f2 | cut -d' ' -f4 #-->/usr/local/bin/node whereis node | cut -d' ' -f1 #-->node: whereis node | cut -d' ' -f2 #-->/usr/bin/node ################################### ######## CHARACTER SLICING ######## ################################### #...slice off the beginning... whereis node | cut -c1- #-->node: /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz whereis node | cut -c2- #-->ode: /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz whereis node | cut -c3- #-->de: /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz #...extract a range... whereis node | cut -c1-13 #-->node: /usr/bi whereis node | cut -c2-13 #-->ode: /usr/bi #...extract some random list of characters (at positions 3, 13, 14, 21, 28, 30)... whereis node | cut -c3,13,14,21,28,30 #-->din/nX #...extract individual characters (at positions 3, 21, 28, 30), and a range of characters (positions 13 to 18)... whereis node | cut -c3,13-18,21,28,30 #-->din/nod/nX ################################### ########## FIELD RANGES ########### ################################### #remember, when you show all fields from "1" to "end"... whereis node | cut -d' ' -f1- #-->node: /usr/bin/node /usr/bin/X11/node /usr/local/bin/node /usr/share/man/man1/node.1.gz #now fields 1 to 2 (where field is delimited by a space)... whereis node | cut -d' ' -f1-2 #-->node: /usr/bin/node #now fields 2 to 3 (where field is delimited by a space)... whereis node | cut -d' ' -f2-3 #-->/usr/bin/node /usr/bin/X11/node #now fields 2 to 4 (where field is delimited by a space) whereis node | cut -d' ' -f2-4 --output-delimiter=$'\n' #-->/usr/bin/node /usr/bin/X11/node /usr/local/bin/node #fields 2 to 4, with field delimited by 5 spaces whereis node | cut -d' ' -f2-4 --output-delimiter=' ' #-->/usr/bin/node /usr/bin/X11/node /usr/local/bin/node #fields 2 to 4, with field delimited by a new line whereis node | cut -d' ' -f2-4 --output-delimiter=$'\n' #-->/usr/bin/node #-->/usr/bin/X11/node #-->/usr/local/bin/node