I've got a file containing:
Georgia
Unix
Google
The desired output is:
Georg
Un
Goog
I've got a file containing:
Georgia
Unix
Google
The desired output is:
Georg
Un
Goog
The shell Parameter Expansion and using Substring removal ${parameter%word}/Substring Expansion ${parameter:offset:length} syntax.
"${line%??}" # strip the shortest suffix pattern match the word
"${line::-2}" # strip last 2 characters (`bash 4.2` and above)
"${line: : -2}" # in older you could add spaces between OR
"${line::${#line}-2}"