Solved

Perl command line search replace word with apostrophe in it

Posted on 2011-02-15
1
883 Views
Last Modified: 2012-05-11
I trying to search and replace using Perl on the command line, not sure how to escape the apostrophe in the command.

ie. Replace Latest's -> Latest
perl -pi -e 's/Latest''s/Latest/g' *.pl <- doesn't work


0
Comment
Question by:freshgrill
1 Comment
 
LVL 1

Accepted Solution

by:
Levant earned 500 total points
ID: 34897232
Here is the line that worked for me:

perl -pi.bak -e "s/Latest\'s/Latest/g;" 1.pl

I think you should use \' (backslash ') to escape the apostrophe.

Sincerely,
Boris
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question