Did someone answer and I missed it?

You shouldn't have a problem executing a sed search/replace for this.
Something like:

sed -e "s/([a-z])(")([a-z])/$1'$3/g"

should work fine. Except for one thing. The escapes for sed and the
escapes for the shell are going to butt heads. Not as badly as they do
when you're looking to edit newline or tab characters, but enough to
cause trouble.

The following "should" work:

sed -e 's/([a-z])(")([a-z])/$1\'$3/g'

It will eliminate shell substitution on the $1 and $3 and I don't
believe there's a conflict when "\'" is shell-replaced with "'" here.

For some of the really gnarly stuff, however, it's often easier to put
the sed commands in a text file and have sed execute it. That way the
shell doesn't muck around with them.

   Tim

On Fri, 2010-11-12 at 10:40 -0500, Ephram wrote:
> Alright, here's my latest problem. I had a massive text file that had
> apostrophes used as quotation marks. Naturally, the easiest thing for me to
> do was a simple search-and-replace in my handy-dandy text editor, replacing
> ' with ". Everything looked great and I proceeded to split the file into 30
> separate parts and format them as web pages.
> 
> In my short-sightedness, I didn't consider contractions within the text
> having their apostrophes replaced as well. Now I am stuck with 30 html files
> that have quotation marks where apostrophes are needed.
> 
> I've been opening each file in Writer to do a regex replacement by searching
> for ([a-z])(")([a-z]) and replacing with $1'$3 which works perfectly, but
> it's tedious. I tried finding a way to do it with sed or grep, but the
> problem I keep running into is the fact I'm searching for delimiters that
> cannot be escaped. Does anyone have any insight as to how I can use sed in
> this case?


---------------------------------------------------------------------
Archive      http://marc.info/?l=jaxlug-list&r=1&w=2
RSS Feed     http://www.mail-archive.com/[email protected]/maillist.xml
Unsubscribe  [email protected]

Reply via email to