Stephane Chazelas schrieb:
Mon, 06 Feb 2006 19:13:06 +0100, Dirk Joos wrote:
>
>>Hi,
>>
>>I want to make all lines the same length.
>>
>>e.g.
>>
>>abc
>>abcde
>>ab
>>abcdefg
>>abc
>>abc
>>
>>
>>abc
>>abcde
>>ab
>>abcdefg
>>abc
>>abc
>>
>>I only have a busybox with the following commands:
>
[]
>
>[, ash, busybox, cat, chmod, clear, cp, cut, date, dd, df, dmesg,
>dos2unix, du, echo, env, expr, false, find, free, grep, halt,
>hostname, ifconfig, ifdown, ifup, inetd, init, insmod, ip, kill,
>killall, ln, loadkmap, login, ls, lsmod, md5sum, mkdir, more,
>mount, mv, nc, nslookup, passwd, pidof, ping, poweroff, ps, rdate,
>reboot, renice, rm, rmdir, rmmod, route, sed, sh, sleep, sync,
>tar, telnet, telnetd, test, time, touch, true, udhcpc, umount,
>uname, unix2dos, uptime, vi, wget, xargs, yes
>
[]
Does this work for you:
file=thefile
if
longest=`
sed 's/././g;x;G;s/^\(\.*\)\n\1./\1./;s/\n.*//;h;$!d' < "$file"
` &&
[ -n "$longest" ]
then
sed "s/\$/$longest/;s/\($longest\).*/\1/" < "$file"
fi
Wow, it is working. You are really fantastic. I have to go now. But when
I'm coming back I'll try to understand this. And I'm sure I'll learn
much by looking at it.
Thanks
Dirk