Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Removing substring from a string

👤 Login to reply

Old 07-28-2005
dmilks dmilks is offline
Registered User
Removing substring from a string

Hi. I want to remove a substring from a string. If I use the "tr" command, it doesn't seem to to what I want it to:

echo './somestring.dat' | tr -d './'
results in

I want it to remove only occurances of the string './', rather than the individual character. The result should be: somestring.dat

How do I do this?

- Dylan
Sponsored Links
Old 07-28-2005
vgersh99's Unix or Linux Image
vgersh99 vgersh99 is online now Forum Advisor  
Forum Advisor
echo './somestring.dat' | sed 's#\./##g'
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with string and substring also I/O ikeQ Shell Programming and Scripting 1 04-09-2010 01:08 PM
get substring from string suman.g Shell Programming and Scripting 5 07-09-2009 01:22 AM
How to get the substring from the string Anshu UNIX for Dummies Questions & Answers 3 06-15-2006 07:52 AM
getting a substring from a string maradona Shell Programming and Scripting 3 03-09-2005 11:05 AM

All times are GMT -4. The time now is 08:55 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
Show Password

Not a Forum Member?
Forgot Password?