The code below works:
Range1="${keys[$i]}"
Range2="${keys[$i+1]}"
a="
sed -n /"
b="/,/"
c="/p"
echo "$a$Range1$b$Range2$c" > temp1.txt
sedcmd=$(grep
sed temp1.txt)
errordata=$($sedcmd < test1.txt)
echo "$errordata" > temp2.txt
However, I am having to echo the contents of the variable to a file which I process further.
What I would like to do is send the data from the $sedcmd < test1.txt to temp2.txt by using: cat test1.txt | $($sedcmd) > temp2.txt. However, this gives me 'No such file or directory' errorr
