On Tue, 28 Jun 2011, Glenn Cogle wrote:
> 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
Here is how I would do the first part of the problem.
Cut and paste this line onto your bash command prompt and hit enter;

rowofchars=abcdefghiZjklmZnopqZrstuZvwxyZz; echo "${rowofchars:0:5}Z"

Cheers Ross Drummond

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

Reply via email to