in reply to Rule-based sorting

Umm... I assume that the "any strings" of fields 1 and 3 cannot contain spaces? Otherwise we are in real trouble... how can you distinguish between spaces that are record seperators and those that are in the string?

Example:

Foo 23 45 Bar _$string1
This could be parsed into the array ('Foo', 23, '45 Bar', '_$string1') or into the array ('Foo 23', 45, 'Bar', '_$string1')...