• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

Need to strip the last character from an awk print statement.

I have the following command that returns the % of disk space used in a partition.
ie: 5%
I need to strip the % off the string and am not sure how to do it.
The command I am using is:
df -lk | awk '{if ($6=="/"){print $5}}'
0
afcnoc
Asked:
afcnoc
1 Solution
 
medveddCommented:
df -lk | awk '{if ($6=="/"){print $5}}' | sed -e 's/%$//'
0
 
afcnocAuthor Commented:
Thanks for the very quick response!
Works great.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now