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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2004
OldNo7 OldNo7 is offline
Registered User
  
 

Join Date: Jul 2004
Location: 95 percent travel
Posts: 1
Question sed question

I'm wondering if you can do the following with sed or some other way. I would like to chang the character "*" in a string to "\052" inside of a script?

i.e.



string="text * text"

#chang to

string="text \052 text"
  #2 (permalink)  
Old 09-10-2008
mvijayv mvijayv is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 16
This works for me ...

$echo "text * text"
text * text

$echo "text * text"|sed 's/\*/\\052/g'
text \052 text

Hope this helps ...
Vj
  #3 (permalink)  
Old 09-10-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,422
bash
Code:
#set -o noglob
#string="text * text"
# echo $string
text * text
# IFS="*"
# set -- $string
# echo $1
text
 # echo $2
 text
# echo $1\\052$2
text \052 text
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0