Skip to main content
1 of 4
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

With perl, finding all sequences of decimal digits and rounding them up to multiple of 4096:

$ echo foo123bar 4095-4097 1e+2 0x1f2 004123 3.4 |
   perl -pe 's{\d+}{int(($& + 4095)/4096)*4096}ge'
foo4096bar 4096-8192 4096e+4096 0x4096f4096 8192 4096.4096
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k