Don't have a linux os booted near by, but in a windows command prompt
(running GnuWin32 Sed, not sure what version) the following works:

SED -r "s/(....)/\1Z/g"  filein > fileout

You need to adjust syntax for linux - I think double quote becomes
single quote is main one?

Regards, Bryce Stenberg.


________________________________

        From: Glenn Cogle [mailto:[email protected]]
        Sent: Tuesday, June 28, 2011 1:07 PM
        To: Canterbury Linux Users Group
        Subject: [Linux-users] help wanted with sed usage


        Hi all sed gurus (& wannabes like me),

        Wanting to `sed` beyond my present understanding;

        echo abcdefghijklmnopqrstuvwxyz | sed 'keep first 5 chars, then
append a Z to every fourth char thereafter, and keep the leftovers too'

        ie

        abcdefghiZjklmZnopqZrstuZvwxyZz

        I think sed would be capable of this - but haven't proven it
yet.

        gc







DISCLAIMER: If you have received this email in error, please notify us 
immediately by reply email, facsimile or collect telephone call to +64 3 
9641200 and destroy the original.  Please refer to full DISCLAIMER at 
http://www.hrnz.co.nz/eDisclaimer.htm





_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

Reply via email to