AWK tutorial: awk remove last character

awk remove last character

use awk length and substr functions

➜  ~ echo "asdfsdfsf" | awk '{t=length($0)}END{print substr($0,0,t-1)}'

This entry was posted in Awk Command, Text Processing and tagged , , , . Bookmark the permalink.