Computing.Net > Forums > Unix > variables

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

variables

Reply to Message Icon

Name: pk
Date: October 1, 2002 at 08:17:10 Pacific
OS: aix
CPU/Ram: p4
Comment:

Hi
I have a string in one variable str1="'abcd '" and i want to replace spaces with * and result in another variable str2. Pl. help me how to do with shell script.

str1="'abcd '"

str2 should be "'abcd***'"

thanks



Sponsored Link
Ads by Google

Response Number 1
Name: LANkrypt0
Date: October 1, 2002 at 08:34:43 Pacific
Reply:

str1="'abcd '"
str1=`echo "$str1" | tr "[ ]" "[*]"`
str2=$str1


0

Response Number 2
Name: pk
Date: October 1, 2002 at 08:49:54 Pacific
Reply:

It worked.
Thanx


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: variables

Variables in Shell SCripting www.computing.net/answers/unix/variables-in-shell-scripting/6020.html

export variables www.computing.net/answers/unix/export-variables/4268.html

Pass environment variables to sed www.computing.net/answers/unix/pass-environment-variables-to-sed/7387.html