The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 09-17-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
Quote:
What if you could possibly have more than one % character at the end of the string? What command would you use then to ensure that there were no % chars at the end?
Code:
echo "82%%%" | sed 's/%*$//'
Quote:
I ask b/c I want to take a directory path that a user passes me, and if there are any / chars at the end, I want to delete them all.
Code:
echo "/this/is/my/path////" | sed 's!/*$!!'