-2

txt 1:

abc
trt
prc    etc

txt 2:

1
2
3     etc

txt 3:

abc1
abc2
abc3  
trt1
trt2
trt3
prc1
prc2
prc3   etc
7
  • 3
    Not doing your homework without you even asking a question of your own (this is a question and answer site) and without you showing an attempt of your own! Oct 27, 2022 at 15:41
  • 3
    also, this has been asked here before, and you've not even read through the list of "related" topics that were offered to you before you clicked on "post" on your question (see the fifth from the top), so -1 for insufficient research. Oct 27, 2022 at 15:58
  • this post ? unix.stackexchange.com/questions/646109/…
    – zoran
    Oct 27, 2022 at 16:05
  • 2
    Here are some tips: If you expect people to make an effort and answer your question, you also need to show you're making an effort. For instance, by writing a clear and detailed question inside the post. By writing examples that are easier to read and understand, and not just "sdfsdfsdf" which shows a total lack of effort from your side. By adding some thoughts about possible tools and methods. Please edit and improve your question. If you show some respect to the site, you might get respect back by an answer. Good luck.
    – aviro
    Oct 27, 2022 at 16:15
  • 2
    While the initial version of the question was gibberish and likely explains the first downvotes, the current version is interesting and IMO doesn't deserve that barrage of downvotes and criticisms and is no less good than half the text-processing questions here. Oct 27, 2022 at 18:38

1 Answer 1

0

If the files can fit in memory:

perl -e 'chomp (@a = <STDIN>); @b = <>;
         for $a (@a) {for $b (@b) {print $a,$b}}' < 'txt 1' 'txt 2'

Or if the Cartesian product can fit in memory, in zsh:

a=( ${(f)"$(<'txt 1')"} )
b=( ${(f)"$(<'txt 2')"} )
print -rC1 -- $^a$^b

(that one removes empty lines for both files)

Not the answer you're looking for? Browse other questions tagged .