Resposta original
A seguinte linha de comando deve fazer o que você quiser,
grep 'L_International_node-globe' text1|tr -s ' ' '\t'|cut -f 2 > text2
- imprima a linha com a palavra-chave (e valor) desejada no arquivo
text1
- converte a separação de espaços para TAB
- imprime o segundo campo (primeiro campo após a palavra-chave)
- redireciona a saída para o arquivo
text2
Não sei ao certo o que você quer dizer com float. O shell irá imprimir a cadeia de caracteres, e vários programas podem interpretá-lo como um número no formato float.
Editar 1
OK, você quer uma vírgula como separador decimal. Isso é feito com a substituição sed
.
grep 'L_International_node-globe' text1|tr -s ' ' '\t'|cut -f 2 | sed 's/\./,/' > text2
Editar 2
Em resposta ao seu sugerido shellscript eu sugiro a seguinte versão modificada,
#!/bin/bash
if [ $# -ne 2 ]
then
echo "
Usage: $0 <path/infile> <path/outfile>
Example: $0 text1 text2"
exit
fi
# extracting the value
var=$(grep 'L_International_node-globe' "$1"|tr -s ' ' '\t'|cut -f 2)
echo "debug1: $var"
# install and use 'bc'
# calculation; 'scale' sets the number of decimals in the output (truncated)
var=$(echo "scale=3
$var/1000000000" | bc) #the result should be in Gigabits
echo "debug2: $var"
# conversion to comma as decimal separator
var=${var/./,}
echo "debug3: $var"
echo "$var" > "$2" # after every execution the output file should have a new value
Exemplos com dados da sua pergunta original,
$ ./scriptname
Usage: ./scriptname <path/infile> <path/outfile>
Example: ./scriptname text1 text2
$ ./script-name text1 text2 ; echo '-----------';cat text2
debug1: 115911592756.879990
debug2: 115.911
debug3: 115,911
-----------
115,911