1
I have a text file that has several lines separated by two points. See for example:
teste1:testee1
teste2:testee2
teste:testeeee
Using a loop for
, I’m trying to get the script to print on the screen the first part and then the second part, for example like this:
$ teste1
$ testee1
$ teste2
$ testee2
# Assim vai indo...
I just don’t understand why he’s just printing everything on the screen before the two dots, and then picking up the part after the two dots. Example of how it’s coming out:
$ teste1
$ teste2
$ teste
# agora começa a imprimir a parte depois dos dois pontos, o que está errado
$ testee1
$ testee2
$ testeeeee
Script code:
for IA in "$(cat teste.txt)"; do
STR1="$(echo "$IA" | cut -d ":" -f1)" #pega a primeira palavra depois dos dois pontos.
STR2="$(echo "$IA" | cut -d ":" -f2)" #pega a segunda palavra depois dos dois pontos.
echo "$STR1"
echo "$STR2"
sleep 3
done