BASH: Removing last howevermany characters of a string


Results 1 to 11 of 11

Thread: BASH: Removing last howevermany characters of a string

Threaded View

  1. #4
    Join Date
    Mar 2001
    Posts
    729
    echo ${z%???}

    That would do it for you. Or, you could do something like this:

    echo z | sed 's/.\{3\}$//'

    (EDIT: had to make 2 corrections to the sed command )
    Last edited by Strogian; 07-25-2003 at 10:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •