Just place an echo before your sed command to see where n why you are going wrong.
One way to go is:
# assuming default IFS
list="2 5 7 10"
for i in $list;do
echo "${i}p"
done | sed -nf - longText.txt
Just place an echo before your sed command to see where n why you are going wrong.
One way to go is:
# assuming default IFS
list="2 5 7 10"
for i in $list;do
echo "${i}p"
done | sed -nf - longText.txt