Hi: I made a script to combine different possibilities with files, but my files has 1000 lines each one, and with awk and echo it takes soo long to generate the output file. Is there anyway to do the same faster?
Example:
fileA.txt is:
dog
cat
horse
fish
fileB.txt is:
good
bad
pretty
ugly
I need fileC to be like:
doggood
dogbad
dogpretty
dogugly
catgood
catbad
catpretty
catugly
etc
Here`s the code:
#!/bin/bash
numA=1
while [ $numA -le 1000 ]; do
numB=1
while [ $numB -le 1000 ]; do
string1=$(awk "NR==$numA" fileA.txt)
string2=$(awk "NR==$numB" fileB.txt)
string3="$string1$string2"
echo "$string3" >> fileC.txt
numB=$(($numB+1))
done
numA=$(($numA+1))
done
it will took weeks. I am new to bash scripting, so if someone has any idea, with a code example will be fine. Thanks