• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

get rid of the single quote

I try to get rid of the single quote character in my file "test.pl" and I can't do it.
Here is what I type:

     perl -p -i -e 's/\'//g' test.pl

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, "test.pl", 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?  test.pl has about 1200 quotes in it and I don't want to do it by hand.
0
dwcronin
Asked:
dwcronin
  • 3
1 Solution
 
Kim RyanIT ConsultantCommented:
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/\'//" test.pl

0
 
Kim RyanIT ConsultantCommented:
Also, many test editors will allow you to do a global search and replace in a file
0
 
dwcroninAuthor Commented:
The double quotes did it.  I'll be darned.  I was trying all kinds of things
but that never entered my mind.

Thanks
0
 
Kim RyanIT ConsultantCommented:
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now