get rid of the single quote

Posted on 2005-05-11
Last Modified: 2010-03-05
I try to get rid of the single quote character in my file "" and I can't do it.
Here is what I type:

     perl -p -i -e 's/\'//g'

After I type the final single quote in the above line and then type "te" and try to use the
tab to complete the name, "", it won't complete the name, so I type out the
name and hit return and it just hangs there.  

How should I do this? has about 1200 quotes in it and I don't want to do it by hand.
Question by:dwcronin
    LVL 19

    Expert Comment

    Some systems require double quotes for the shell to work correctly. The -i.bak option will also make a backup of your file before it is altered, which can be handy.
    perl -i.bak -pe "s/\'//"

    LVL 19

    Expert Comment

    Also, many test editors will allow you to do a global search and replace in a file

    Author Comment

    The double quotes did it.  I'll be darned.  I was trying all kinds of things
    but that never entered my mind.

    LVL 19

    Accepted Solution

    No problem. I think what happens is your second single quote (after the back slash) tells the OS that the string is terminated, and your third single quote is starting a new string, which is why your shell hangs. The double quotes allow you to escape or literally interpret a single quote.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    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).

    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    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.…
    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…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    759 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

    9 Experts available now in Live!

    Get 1:1 Help Now