Solved

Perl command line search replace word with apostrophe in it

Posted on 2011-02-15
1
873 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now