tags:

views:

73

answers:

1

My cUrl call is returning HTML code like:

"Some stuff."

and I'd like to convert it to a UNIX string like:

"Some stuff."

Is there a way to do this without using search and replace?

+4  A: 

perl -n -MHTML::Entities -e 'print decode_entities($_);'

Wooble
I'm having trouble getting this to work. When I replace `$_` with my variable, it isn't expanded because of the single quotes. The `-n` flag also causes this line to go into an endless loop. I have no perl background, btw.
kubi
You'd want to pipe your existing output through that perl command. The -n causes the command to execute for each line in the input, and $_ is set to the value of each line.e.g.: wget 'http://foo.com/bar' | perl -n -MHTML::Entities -e 'print decode_entities($_);'
Wooble
That was perfect. Thanks!
kubi