PmWiki

pmwiki.org

edit SideBar

Perl One-Liners

dos2ux, ux2dos

        perl -wpe 's/\r\n/\n/'
        perl -wpe 's/\n/\r\n/'

lc,uc

        perl -wne 'print lc'
        perl -wne 'print uc'

ssp

        perl -wne 'print if /\S/ || $a; $a = /\S/'

rmnl

        perl -wne 'print if /\S/'

nodups

        perl -wne 'our %seen; print unless $seen++'

rot13

        perl -wpe 'tr/a-zA-Z/n-za-mN-ZA-M/'

shuffle

        perl -MList::Util=shuffle -we 'print shuffle <>'