grepを助けることができますか?私は以下を持っています:
variable="RMN quota: 0 bytes"
そして
variable="RMN quota: 1.56 bytes"
出力を取得するターゲットID:0または1.56。
grepで何をしますか?
ベストアンサー1
POSIX的に:
n=${variable% bytes} # strip the trailing " bytes"
n=${n##*[[:blank:]]} # strip the leading part up to the rightmost blank