Menu

#10 SUBSTR negative

open-remind
nobody
Devmon (9)
5
2011-01-22
2010-03-04
No

This patch allows use of negative offsets for the SUBSTR directive, useful for TABLE:plain messages.

For example, for the linux-wrt template's disk, one could use the following in transforms:
DiskSizeSpaces : REGSUB : {DiskSize} /(.*)/ $1/
DiskSizeSpace : SUBSTR : {DiskSizeSpaces} -8
Then use {DiskSizeSpace} instead of {DiskSize} for a right-aligned value in an 8 space-filled field.

Discussion

  • Richard Finegold

    Patch for dm_template.pm and dm_tests.pm

     
  • Richard Finegold

    Due to the conversion of the Details to HTML, it isn't obvious that the REGSUB line has numerous spaces between "/(.*)/" and "$1/".

     
  • Buchan Milne

    Buchan Milne - 2011-01-22

    I think the example you gave above isn't complete, I get 'No data'. for {DiskSizeSpace}

    Also ... what is the motivation for this? Just cleaning up the (e.g.) disk output to look more regular (like df or df -P)?

    On most of my systems, df -P isn't correctly aligned anyway (as I'm mostly using lvm everywhere), and on some, 8 characters isn't enough.

     
  • Buchan Milne

    Buchan Milne - 2011-01-22
    • status: open --> open-remind
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.