Ruby: how to match double quote in regex
I am trying to remove some double quotes (") from a text file using Ruby one liner with little success.
I have tried the following and some variations with no success.
ruby -pe 'gsub(/\"/,"")' < myfile.txt
This gives me the following error:
-e:1: Invalid argument - < (Errno::EINVAL)
I am running Ruby on a Win machine:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
Any idea?
source to share
It looks like the problem is with the shell.
Your error message is from Ruby, so it seems like Ruby is receiving <
as an argument. This means that the shell does not perform any redirects.
I don't have a windows machine, so I would double-clarify that you are redirecting first. On first inspection, I think there < myfile.txt
should be<myfile.txt
source to share