On Tue, 2011-06-28 at 13:59 +1200, Glenn Cogle wrote:
> Presently I think sed is the tool, as eventually the input will be a
> multi-line text file;
> 
> cat $FILE | sed -e 'fiddle about with every line' > $OUTPUT

If you just want a solution then I've attached one for you. If you want
to do it with sed I don't know how to achieve that.

hads
-- 
http://nicegear.co.nz
New Zealand's Open Source Hardware Supplier
import sys

try:
    infile = sys.argv[1]
except:
    sys.stderr.write('No input file\n')
    sys.exit(1)

for line in file(infile):
    try:
        out, body = line[:5], line[5:].strip()
    except IndexError:
        continue
    i = 1
    while i < len(body):
        out += body[i]
        if i % 4 == 0:
          out += 'Z'
        i += 1

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

Reply via email to