Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Keep It Simple, Stupid

Comment on


My most important one liner: if I set up some coffee and continue working, I often forget to fetch it, and it gets cold... so:

perl -le 'sleep(300); print qq~\a~ x 10'

reminds me that I must not forget to fetch the fresh coffee; this is the oneliner I use most often

other cases, for filtering or replacing data in files, e.g. printing objects in LDIF files which have the auxiliary object class dxmADsUser:

perl -e 'BEGIN { $/="\n\n" }' -ne 'print if /^objectClass: dxmADsUser/si' file1 > file2

or replacing domain components on-the-fly:

perl -i.bak -pe 's/dc=domain1,dc=tld$/dc=domain2,dc=tld/' file

or counting something, e.g. how often each attribute is existing in an ldif file:

perl -MData::Dumper -ane '$count_of{$F[0]}++' -e 'END { print Dumper(\%count_of) }' file

Best regards,

In reply to Re: What one-liners do people actually use? by strat
in thread What one-liners do people actually use? by TomDLux

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (8)
    As of 2014-03-15 16:46 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (319 votes), past polls