Code for extracting from the right side with cut command? Code for extracting from the right side with cut command? bash bash

Code for extracting from the right side with cut command?


you could use rev

echo "abc-def-ghi-jkl" | rev | cut -d- -f-2 | rev


$ echo "abc-def-ghi-jkl" | cut -d- -f3-ghi-jkl

-2 cuts up to the 2nd field. 3- cuts from the 3rd field on.