Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash get last field in line

Use rev command altogether with cut command as follows:
echo "a1 a2 a3 a4 a5" | rev | cut -d ' ' -f '1' | rev
#rev reverses string, then you cut from 2th field to end and reverse back
 
PREVIOUS NEXT
Tagged: #bash #field #line
ADD COMMENT
Topic
Name
9+7 =