TXR Lisp:
Warmup: just get the data structure first:
$ txr -p '(comb (get-lines (open-files *args*)) 2)' file1 file2 file3
(("one" "two") ("one" "three") ("one" "four") ("one" "five") ("one" "six")
("two" "three") ("two" "four") ("two" "five") ("two" "six") ("three" "four")
("three" "five") ("three" "six") ("four" "five") ("four" "six")
("five" "six"))
Now just a matter of getting the right output format. If we catenate the pairs together and then use tprint (implicitly via the -t option), we are there.
First, the catenation via mapping through cat-str:
$ txr -p '[mapcar cat-str (comb (get-lines (open-files *args*)) 2)]' file1 file2 file3
("onetwo" "onethree" "onefour" "onefive" "onesix" "twothree" "twofour"
"twofive" "twosix" "threefour" "threefive" "threesix" "fourfive"
"foursix" "fivesix")
OK, we have the right data. Now just use tprint function (-t) instead of prinl (-p):
$ txr -t '[mapcar cat-str (comb (get-lines (open-files *args*)) 2)]' file1 file2 file3
onetwo
onethree
onefour
onefive
onesix
twothree
twofour
twofive
twosix
threefour
threefive
threesix
fourfive
foursix
fivesix
Finally, we read the question again and do permutations instead of combinations with perm rather than comb, as required:
$ txr -t '[mapcar cat-str (perm (get-lines (open-files *args*)) 2)]' file1 file2 file3
onetwo
onethree
onefour
onefive
onesix
twoone
twothree
twofour
twofive
twosix
threeone
threetwo
threefour
threefive
threesix
fourone
fourtwo
fourthree
fourfive
foursix
fiveone
fivetwo
fivethree
fivefour
fivesix
sixone
sixtwo
sixthree
sixfour
sixfive