I have a bash script where I get the disk usage, for example 60%. How can I remove the % symbol? Using grep or awk?
|
feedback
|
|
This should do it:
Pipe your string through it for the best results. | |||||||
feedback
|
|
Instead of sed, use tr.
| |||
|
feedback
|
|
There is no need for external tools like
This statement removes the shortest matching substring (in this case an escaped See http://tldp.org/LDP/abs/html/parameter-substitution.html#PSOREX1 for more information. | |||
|
feedback
|
|
If the disk usage is in a variable, bash can do the removal as part of a variable substitution:
| |||
|
feedback
|