Jurgen, This is exactly what I needed. Thanks,
Best rgds, Jeri On 5/28/09, Jürgen Krämer <[email protected]> wrote: > > > Hi, > > Jeri Raye schrieb: > > > > I a memory dump file which needs to be formatted in another way. > > What is needed is the following > > - the first column needs to be removed > > - from the 8-characters long hexcode the leading zero's needs to be > > removed.(so 000ABCDE must be come ABCDE) > > from your example I guess you want only the first three leading zeroes > to be removed. > > > - at last a newline must be added at the top with the code @0000. > > > > To give an example: > > > > Input file: > > +-START OF MEM FILE -(not part of real file, only for explaining in > > this > > mail)-----------------------------------------------------------------------+ > > @0000 00000701 0002E73D 00000700 0002E73E 0002E73F 000007FF 0002C7A4 > > 00000701 0002E72C 00030109 0002C7A4 00030109 000007FF 0002C7A4 > > 000007FF 000301EE > > @0040 000007FE 000301EE 000007FD 000301EE 000007FB 000301EE 000007F7 > > 000301EE 00034010 000007EF 000301EE 000007DF 000301EE 000007BF > > 000301EE 00034010 > > @0080 0000077F 000301EE 000007BF 000301EE 000007DF 000301EE 000007EF > > 000301EE 000007F7 000301EE 000007FB 000301EE 000007FD 000301EE > > 00034010 0003400E > > +-END OF MEM FILE ---(not part of real file, only for explaining in > > this > > mail)-----------------------------------------------------------------------+ > > This should be three lines starting with @0000, @0040, and @0080, > respectively, right? > > > The output file must then become as below > > +-START OF MEM FILE -(not part of real file, only for explaining in > > this > > mail)-----------------------------------------------------------------------+ > > @0000 > > 00701 2E73D 00700 2E73E 2E73F 007FF 2C7A4 00701 2E72C 30109 2C7A4 > > 30109 007FF 2C7A4 007FF 301EE > > 007FE 301EE 007FD 301EE 007FB 301EE 007F7 301EE 34010 007EF 301EE > > 007DF 301EE 007BF 301EE 34010 > > 0077F 301EE 007BF 301EE 007DF 301EE 007EF 301EE 007F7 301EE 007FB > > 301EE 007FD 301EE 34010 3400E > > +-END OF MEM FILE ---(not part of real file, only for explaining in > > this > > mail)-----------------------------------------------------------------------+ > > > " Remove the first column execpt for lines starting with "@0000 " > :v/^...@0000 \+/s/^...@\x\+\ \+// > " Put "@0000" on a separate line > :g/^...@0000/s/ \+/\r/ > " Remove three leading zeroes > :v/^...@0000/s/\<000//g > > Regards, > Jürgen > > -- > Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us. (Calvin) > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
