ajuda com shell script [RESOLVIDO]
Responder tópico2. Re: ajuda com shell script
Enviado em 24/01/2023 - 11:49h
Considerando o arquivo com as informações em /tmp/aula.txt
# cat /tmp/aula.txt
aula
dora=15
bora=25
vem=45
gen=56
legal=80
Fiz dessa forma, mas deve ter outras varias(melhores provavelmente), mas funciona assim hehe
#-------------------------------------------------------------------------------------#
"Falar é fácil, me mostre o código." - Linus Torvalds
#-------------------------------------------------------------------------------------#
# cat /tmp/aula.txt
aula
dora=15
bora=25
vem=45
gen=56
legal=80
Fiz dessa forma, mas deve ter outras varias(melhores provavelmente), mas funciona assim hehe
for i in $(grep = /tmp/aula.txt ); do NUM=$(echo $i |cut -d "=" -f2) ; [ $NUM -ge 80 ] && echo 0 ;done
#-------------------------------------------------------------------------------------#
"Falar é fácil, me mostre o código." - Linus Torvalds
#-------------------------------------------------------------------------------------#
3. Re: ajuda com shell script [RESOLVIDO]
Enviado em 24/01/2023 - 14:17h
Considerando que o arquivo esteja no formato:
string1=valor1
string2=valor2
string3=valor3
Tente:
string1=valor1
string2=valor2
string3=valor3
Tente:
awk -F '=' -v value="80" 'END {print ($2 >= value) ? "0" : "1"}' arquivo 4. Re: ajuda com shell script [RESOLVIDO]
Enviado em 24/01/2023 - 16:53h
+ uma alternativa:
grep -Eq '=([89][0-9]|1[0-9]{2})$' arquivo && echo 0 || echo 1
Obs.: A "Expressão regular", casa de 80 a 199.
______________________________________________________________________
Att.: Marcelo Oliver
______________________________________________________________________
grep -Eq '=([89][0-9]|1[0-9]{2})$' arquivo && echo 0 || echo 1
Obs.: A "Expressão regular", casa de 80 a 199.
______________________________________________________________________
Att.: Marcelo Oliver
______________________________________________________________________
5. Obrigado a todos pessoal!
Enviado em 24/01/2023 - 19:14h
muito agradecido pela ajuda vcs são demais
Responder tópico
Entre na sua conta para responder.
