Contrasting Sed & PERL

Contrasting Sed & PERL

$ sed 's/\([0-9]*\)\.\{5,\}\([0-9]*\)/\1-\2/' numbers

1-5

5-10

10-20

100-200

$ perl -ne 's/([\d]+)\.{5,}([\d]+)/\1-\2/; print' numbers

1-5

5-10

10-20

100-200

Previous slide Next slide Back to the first slide View Graphic Version