I have to Empty annotations with no "Best-hit" & "arabi-defline" columns
I'll assume that you mean:
I have to remove the line that doesn't contain value for the Best-hit
and arabi-defline
So if it's the case, here a simple solution using awk
:
awk '{if ($3 && $4){print $0}}' test.txt
I think awk
is a better fit than bash
in this case but you can also do it using bash with something like:
while read -r pacId locusName bHAN aD; do [[ $bHAN && $aD ]] && echo "${pacId} ${locusName} ${bHAN} ${aD}"; done < test.txt
Of course if you want to change the default separator by something else than any blank, you can just override the IFS
like this:
while IFS='' read -r pacId locusName bHAN aD; do [[ $bHAN && $aD ]] && echo -e "${pacId}${locusName}${bHAN}${aD}"; done < test.txt
Same thing for awk
, you'll just have to use -F
to change the default separator.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…