morgon has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for a one-liner that takes an utf8 encoded text-file and prints every line with a bullet-point character added in front (this is for displaying via conky).
My fist "cowboy"-attempt was:
But that is of course not correct and produces the "wide character in print"-warning.perl -ne 'print "\N{U+2022} $_"' todo.txt
So I did this:
And this seems to do the trick, but it's quite a mouthful for the simple task at hand.perl -MEncode -ne 'print encode('utf8',"\N{U+2022}"), " $_"' todo.txt
So my question is:
Is this the way to do it or is there a shorter/better way?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unicode in one-liner
by 1nickt (Canon) on Dec 26, 2016 at 22:55 UTC | |
by morgon (Priest) on Dec 27, 2016 at 00:46 UTC | |
by Anonymous Monk on Dec 27, 2016 at 03:16 UTC | |
by Athanasius (Archbishop) on Dec 27, 2016 at 03:35 UTC | |
by Anonymous Monk on Dec 27, 2016 at 04:48 UTC | |
by morgon (Priest) on Dec 27, 2016 at 04:16 UTC | |
by Anonymous Monk on Dec 27, 2016 at 04:46 UTC | |
by shawnhcorey (Friar) on Dec 29, 2016 at 13:06 UTC | |
by haukex (Archbishop) on Dec 29, 2016 at 13:31 UTC | |
|
Re: Unicode in one-liner
by BrowserUk (Patriarch) on Dec 26, 2016 at 20:07 UTC |