how to check if I find a pattern with sed in loop
by mierdatuti from LinuxQuestions.org on (#5803H)
Hi,
I have these code, to find values of a array in a file. The script only search in some lines number that the are in other file
Code:
while read -r Line; do
echo "Line $Line"
for i in "${patrones[@]}"
do
if [[ -n $(sed "${Line}!d;/'"${i}"'/I!d" $rutaFich/titles) ]]; then
echo "find it pattern $i en la linea $Line"
exit 0
else
echo "No encontrado el patron $i en linea $Line"
fi
done
done < $rutaFich/differencesBut not works. If find a pattern always goes to the else clause.
Any help please?
Thanks


I have these code, to find values of a array in a file. The script only search in some lines number that the are in other file
Code:
while read -r Line; do
echo "Line $Line"
for i in "${patrones[@]}"
do
if [[ -n $(sed "${Line}!d;/'"${i}"'/I!d" $rutaFich/titles) ]]; then
echo "find it pattern $i en la linea $Line"
exit 0
else
echo "No encontrado el patron $i en linea $Line"
fi
done
done < $rutaFich/differencesBut not works. If find a pattern always goes to the else clause.
Any help please?
Thanks