I have a file like
foo.txt
xxx B=C D: A
yyy F=H D:A
zzz K=L D: A
fff M=H D:/llll
kkk S=D D: /kkkkk
this is what I try to get;
xxx B=C; D: A ;pass
yyy F=H; D:A ;pass
zzz K=L; D: A ;pass
fff M=H; D:/llll ;try
kkk S=D; D: /kkkkk/bb ;try
The second part of line which starts with "D:",if starts with "/", it should be write "try" else it has to write "pass" end of the line for every line in it.
I can read file like this but there is spaces which is another problem
In addition after "D:" always starts with "A" or "/".
I tried while loop but I have not succeeded.
cat /tmp/foo.txt | cut -d ":" -f,2
Output
A (one empty space)
A (none)
A (three empty space)
/llll (none)
/kkkkk/bb (two empty space)
This is a example what I have tried
while read -r line;
do
if [[ $line ]]; then
echo $line "try"
else
echo $line "pass"
fi
done < foo.txt