Removing non-numeric character from output

Posted on 2006-04-24
Last Modified: 2013-12-27
Hi All,

On my SunOS 5.9 devbox:

The output of:  df -k |grep /dev/dsk/c0t0d0s0|tail -1|awk '{print $5}'
is:  76%

I need to remove the trailing % sign, as I want to assign this value to a varianble (and then us it in a script to send out notifications)

How do I remove the % from the output?

Question by:m0nk3yza
    1 Comment
    LVL 1

    Accepted Solution

    There are many many ways of doing this. This was the first one I could think of  but might be a bit of an overkill.

    df -k |grep /dev/dsk/c0t0d0s0|tail -1|awk '{print $5}'  |  sed -e 's/%//g'

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    730 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

    15 Experts available now in Live!

    Get 1:1 Help Now