in reply to replace a line with lines based on information extracted from these line using Perl
#!/usr/bin/perl # https://perlmonks.org/?node_id=1225199 use strict; use warnings; while( <DATA> ) { s!\s*\.comm\s+(_\w+),(\d+),(\d+)\n! ".data\n$1:\n" . " .data.32 0\n" x ($2/$3)!e; print; } __DATA__ .comm _resultAvg,8,4 .comm _resultSwap,8,4 .comm _resultMax,20,4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: replace a line with lines based on information extracted from these line using Perl
by sajjad (Initiate) on Nov 04, 2018 at 17:05 UTC |