cut last field bash code example
Example 1: cut last field delimiter
Use rev command altogether with cut command as follows:
echo "1 2 3 4 5" | rev | cut -d ' ' -f '2-' | rev
#rev reverses string, then you cut from 2th field to end and reverse back
Example 2: bash delete the last line of a file
# Basic syntax:
sed -i '$d' input_file
# Note, -i means that the input_file will be modified in place
Example 3: bash cut delimiter last field
echo 'maps.google.com' | rev | cut -d'.' -f 1 | rev