Solved

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

Posted on 2010-09-10
2
522 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
ID: 33649460
df -lk | awk '{if ($6=="/"){print $5}}' | sed -e 's/%$//'
0
 

Author Closing Comment

by:afcnoc
ID: 33649563
Thanks for the very quick response!
Works great.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to create custom bootable image of Centos 7.2 4 99
Syslinux UEFI USB boot 4 364
Backup Ubuntu 3 369
Linux alternative boot CD? 28 102
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

21 Experts available now in Live!

Get 1:1 Help Now