• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

Removing non-numeric character from output

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?

Regards,
Jo
0
m0nk3yza
Asked:
m0nk3yza
1 Solution
 
zzzztjCommented:
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'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now