Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • I see this works as it prints the desired output but it doesn't save the changes to the existing file. I'm not opposed to creating a second file if necessary. Commented Jan 16, 2017 at 18:05
  • @EmilyShaffer oh, I hadn't realized that was what you wanted. Just add the -i flag: perl -i -pe "tr/'\"/\"'/ if /^KEYWORD/" file Commented Jan 16, 2017 at 22:41
  • I tried this and it worked also. Commented Jan 20, 2017 at 19:48