Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 (Chancellor) 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 examining the Monastery: (8)
As of 2015-07-05 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls