Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: What one-liners do people actually use?

by Siddartha (Curate)
on Dec 09, 2005 at 00:13 UTC ( #515427=note: print w/ replies, xml ) Need Help??


in reply to What one-liners do people actually use?

I sometimes pipe stuff through the following one liner for utf8 conversion:

cat my_file | perl -e 'use Encode "from_to"; while (<>) {my $s = $_; f +rom_to($s,"iso-8859-1","utf8"); print $s}'


Comment on Re: What one-liners do people actually use?
Download Code
Re^2: What one-liners do people actually use?
by Your Mother (Canon) on Dec 09, 2005 at 07:09 UTC

    Nice++. I was going to ask about something like this on SOPW the other day but was a bit embarrassed b/c I knew there must be a super simple way that I ought to be able to figure out myself.

Re^2: What one-liners do people actually use?
by BrowserUk (Pope) on Dec 09, 2005 at 07:20 UTC

    You can save yourself a bit of typing there:

    perl -MEncode=from_to -pe"from_to( $_, 'iso-8859-1','utf8' )" infile > + outfile

    Switch the quotes on *nix.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515427]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2014-10-23 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls