Исправление emulek, (текущая версия) :
$ echo "1 Name http://example.com/
21 Name 2 http://example.com/
337 Name (AB) AB http://example.com/
300016 Name5 http://example.com/
Name (name) http://example.com/" |\
sed -r 's/^[0-9]+\s+/&☣/;tl;s/.*/☣&/;:l;/^[^☣]{10}/bm;s/☣/ &/;bl;:m;s/☣//;s/.* /&☣/;:n;/^[^☣]{40}/{s/☣//;b};s/☣/ &/;bn'
1 Name http://example.com/
21 Name 2 http://example.com/
337 Name (AB) AB http://example.com/
300016 Name5 http://example.com/
Name (name) http://example.com/
PS: люблю перед сном написать что-нить упоротое…
Исходная версия emulek, :
$ echo "1 Name http://example.com/
21 Name 2 http://example.com/
337 Name (AB) AB http://example.com/
300016 Name5 http://example.com/
Name (name) http://example.com/" |\
sed -r 's/^[0-9]+\s+/&☣/;tl;s/.*/☣&/;:l;/^[^☣]{10}/bm;s/☣/ &/;bl;:m;s/☣//;s/.* /&☣/;:n;/^[^☣]{40}/{s/☣//;b};s/☣/ &/;bn'
1 Name http://example.com/
21 Name 2 http://example.com/
337 Name (AB) AB http://example.com/
300016 Name5 http://example.com/
Name (name) http://example.com/