Combine words

hello i need help with something please

i have 2 text file contains words each word on line same for text 2 what i want to do is merge each word from text 1 to all the words on text2

Example:

text1 file contains:
hot
bike

text2 file contains
sport
world
community

results should be like this:
hotsport
hotworld
hotcommunity
bikesport
bikeworld
bikecommunity

1 Like

Iā€™m sure there are softwares that can do this already, otherwise you can write a very simple script to do it, take it as a reason to learn a little bit of coding if you never tried it ^^

2 Likes
BLOCK:FileWriteLines
LABEL:File WriteLines 1
  path = "Combine/Prefix.txt"
  lines = ["hot", "bike"]
ENDBLOCK

BLOCK:FileWriteLines
LABEL:File WriteLines 2
  path = "Combine/Suffix.txt"
  lines = ["", "sport", "world", "community"]
ENDBLOCK


//------------------PREFIX------------------
BLOCK:FileReadLines
LABEL:File Read Lines 1
  path = "Combine/Prefix.txt"
  => VAR @Prefix
ENDBLOCK
//LastIndexPrefix
string last1 = Prefix.Last();
int LastIndexPrefix = Prefix.ToList().IndexOf(last1);
BLOCK:ConstantInteger
  => VAR @PrefixIndex
ENDBLOCK
//-----------------SUFFIX------------------
BLOCK:FileReadLines
LABEL:File Read Lines 2
  path = "Combine/Suffix.txt"
  => VAR @Suffix
ENDBLOCK
//LastIndexSuffix
string last2 = Suffix.Last();
int LastIndexSuffix = Suffix.ToList().IndexOf(last2);
BLOCK:ConstantInteger
  => VAR @SuffixIndex
ENDBLOCK
//-----------------COMBINE-----------------


#LOOP
WHILE INTKEY @SuffixIndex LessThan @LastIndexSuffix
SuffixIndex++;
BLOCK:FileAppendLines
  path = "Combine/Result.txt"
  lines = $["<Prefix[PrefixIndex]><Suffix[SuffixIndex]>"]
ENDBLOCK
END

IF INTKEY @PrefixIndex LessThan @LastIndexPrefix
SET VAR SuffixIndex 0
PrefixIndex++;

JUMP #LOOP

END

Try this and Good Luck :slight_smile: @SAVA

1 Like

There are Online Combiner, just research a little bit and you will find it.