Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIX Korn shell scripting

Status
Not open for further replies.

davey001

Programmer
Jun 4, 1999
2
0
0
US
Visit site
The message in the bottle is can someone enlighten me on how to test the END of a character string1 for a match on character string2 ? <br>
I am looking at some type of regular expression as the available functions don't seem to help with this. Basically I want to see if the last few characters of a string match a another string.<br>
<br>
Thanks,<br>
-dR-
 
Assuming these character strings are in a variable, say FRED, use the reference ${FRED##xxx}.<br>
xxx refers to a RE matching the end of your string. You may have trouble unless you know either the total number of characters (say it's 5, then xxx would be ????), or some other character to match (say it's an underscore, then xxx would be *_).<br>
Hope this helps,<br>
happy trails
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top