Here is my code.
I can give why I do this code. I try to take 1 file, take a line and guess if this line 1 have any "", if yes, I change to the second file and try to see if the line 1 have "" if no, I keep the data of file2/line1 and get in the final file.
But my question is: How doing an escape quote ?
#! /bin/bash
compteur="1"
ligne="2"
rm testfinal 2>/dev/null
touch testfinal 2>/dev/null
#########BOUCLE PERMUTATION LIGNE
while (( $ligne < "32" ))
do
if [ 'cat test$compteur | sed -n $ligne\p | awk -F" "'{print $2}' ' == "*" ]
then compteur=$((compteur+1));
else
cat test$compteur | sed -n $ligne\p >> testfinal
ligne=$((ligne+1));
compteur=$((compteur=1));
fi
done
Edit: I find myself, the answers his:
if [ "sed -n $ligne\p test$compteur | awk -F" " '{print $2}'
" == "*" ]
"sed [et cetera]"
will never be equal to"*"
, the test will always fail, and theelse
clause will execute for literally every single case. – DopeGhoti Oct 25 '18 at 18:59