in reply to Simple regex

objdump outputs :
cls.c.o: file format pe-i386 Contents of section .text: 0000 636d6400 5589e583 ec0831c0 83e4f0e8 cmd.U.....1..... 0010 00000000 e8000000 0083ec0c 68000000 ............h... 0020 00e80000 000031c0 c9c39090 90909090 ......1.........
what i want the reget to output :
0000636d64005589e583ec0831c083e4f0e8001000000000e80000000083ec0c680000 +00002000e80000000031c0c9c3909090909090

Replies are listed 'Best First'.
Re^2: Simple regex
by Random_Walk (Prior) on Jan 19, 2005 at 14:10 UTC

    print for $text=~/[0-9a-f]{4}/g;

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re^2: Simple regex
by ww (Archbishop) on Jan 19, 2005 at 17:16 UTC
    so what you really want to do is strip the last 17 (decimal) bytes (or 18 or 19 depending on your newline) from each line and join on the resultant line ends and spaces?

    Also, do you mean to imply that there will be 3 lines (per item) of useful info in the dump, or do you need to deal with a variable (unpredictable) number of lines?

    Yes, there's a premium on brevity here, but an even higher premium on precision!