Solved

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

Posted on 2010-09-10
2
528 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux alternative boot CD? 28 134
Clonezilla doesn't restore from image 12 114
Encrypted Laptop running Linux 3 132
Issue with SFTP on non-root account using Guacamole  / GUAC 2 101
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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