Solved

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

Posted on 2010-09-10
2
519 Views
Last Modified: 2013-12-06
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
Comment
Question by:afcnoc
2 Comments
 
LVL 16

Accepted Solution

by:
medvedd earned 500 total points
Comment Utility
df -lk | awk '{if ($6=="/"){print $5}}' | sed -e 's/%$//'
0
 

Author Closing Comment

by:afcnoc
Comment Utility
Thanks for the very quick response!
Works great.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now