LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2007, 01:40 PM   #1
Zeno McDohl
Member
 
Registered: Apr 2005
Location: Saratoga, NY
Distribution: Slackware
Posts: 317

Rep: Reputation: 30
Find replace not working


Following this:
http://snippets.dzone.com/posts/show/116

Doesn't work. I'm doing:

Quote:
# cat test.txt
hi example@aol.com
example@aol.com test
example@aol.com
# perl -pi -e 's/example@aol.com/example@msn.com/g' test.txt
# cat test.txt
hi example@aol.com
example@aol.com test
example@aol.com
Nothing happened.
 
Old 08-06-2007, 01:49 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Hi,

The @ is special, you need to escape it:

perl -pi -e 's/example\@aol.com/example\@msn.com/g' test.txt

Hope this helps.
 
  


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
Find and replace string Johng Programming 9 01-13-2010 04:50 AM
Find and Replace upwordz Linux - Newbie 7 05-10-2007 09:03 PM
find and replace script UnixKiwi Programming 12 04-16-2007 11:08 PM
find and replace happy78 Programming 11 09-10-2005 10:21 AM
Find and Replace? duerra Linux - General 9 01-28-2004 04:07 AM


All times are GMT -5. The time now is 02:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration