With a POSIX shell (bash, ksh, some flavours of sh, ...):
echo ${var%??}
Otherwise:
expr "$var" : '\(.*\)..'
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2001, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
Hello,
I am processing a tab delimited file in awk (actually nawk). Some
of the fields have trailing blanks which I need to remove. Anyone
have ideas on how to do this?
thanks in advance,
Eric
ps. is this the correct group for awk questions?
3. Problem: Howto trim a shell-script variable-string?
4. 16650 Uart Setup Question...
5. trim last few chanracter from a string
6. Is 3c905B-TX Ethernet Card Support by AIX ?
7. Trimming Leading Characters
9. Check whether chars other than those in specified range are in a string
10. print given character range.
11. printing characters in a range ...
12. How to do a character substition over a variable-width range?