Solved

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

Posted on 2010-09-10
2
524 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Edit file on Ubuntu as root 23 113
Linux TCP flaw lets 'anyone' hijack Internet traffic 9 79
grub issue after new Debian installation 2 41
Running Jira on Raspberry PI 2? 3 334
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 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