Convert string output(bash script) -
how convert output vendor_id : genuineintel
vendor_id = genuineintel
using cut command?
#!/bin/bash vendorid=`cat /proc/cpuinfo | grep 'vendor_id'|cut -d`=`-f 5` vendor_id: genuineintel echo $vendorid
you can use tr
anslate:
vendorid=$(grep 'vender_id' /proc/cpuinfo | tr ':' '=') printf "%s\n" "$vendorid"
i changed backticks $(..)
since easier nest. remember double quote variable expansions $vendorid
-> "$vendorid"
or undergo word splitting.
tr
in case change colons equal signs, eg:
% echo "a:b:c" | tr ':' '=' a=b=c