LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2008, 08:54 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
sorry, but how to replace3 points "..." with sed or awk ?


Hello,
Sorry for the question , but I cannot replace 3 points ?

Code:
echo "this is .... " | sed  -e 's/.../pointreplaced/g'
It shouldnt be difficult for programers/coders
Thx
 
Old 04-19-2008, 09:01 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Why are you sorry???

First, you don't want the -e option unless your are using a sed script.

Second, "." has a special meaning (any character), and therefor needs to be escaped.

eg:
echo "this is ...." | sed 's/\.\.\./newstuff/g'

OR:
echo "this is ...." | sed -r 's/\.{3}/newstuff/g'
 
Old 04-19-2008, 09:12 AM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by pixellany View Post
Why are you sorry???

First, you don't want the -e option unless your are using a sed script.

Second, "." has a special meaning (any character), and therefor needs to be escaped.

eg:
echo "this is ...." | sed 's/\.\.\./newstuff/g'

OR:
echo "this is ...." | sed -r 's/\.{3}/newstuff/g'
thanks{300000000} !{300000000}
 
Old 04-19-2008, 10:33 AM   #4
toreric
Member
 
Registered: Dec 2005
Location: Tväråmark, Sweden
Distribution: Debian/Kubuntu
Posts: 105

Rep: Reputation: 27
Try

echo "this is .... " | sed -e 's/\.\.\.\./\.3 points replaced/g'

to start with and you may find your exact solution after some variation...
 
Old 04-19-2008, 10:49 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
If the string containing ... is stored in a shell variable, you can simply do
Code:
string=p...o
echo ${string/.../ipp}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
awk question on handling *.CSV "text fields" in awk jschiwal Programming 8 05-27-2010 06:23 AM
Sed/Awk: print lines between n'th and (n+1)'th match of "foo" xaverius Programming 17 08-20-2007 11:39 AM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
LXer: Dell Won't Support Linux On The Client; Points To "Community" ... LXer Syndicated Linux News 0 11-02-2006 02:21 PM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 12:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration