Operating System - HP-UX
1847245 Members
2628 Online
110263 Solutions
New Discussion

how to remove "%" out of "5%"

 
SOLVED
Go to solution
Brian Lee_4
Regular Advisor

how to remove "%" out of "5%"

I would like to change 5% to 5 out of "bdf" command outputs.
any command ?
brian lee
5 REPLIES 5
James A. Donovan
Honored Contributor

Re: how to remove "%" out of "5%"

really depends on your script, but you could probably just add something like: |awk -F"%" '{print $1}'

Remember, wherever you go, there you are...
Pete Randall
Outstanding Contributor
Solution

Re: how to remove "%" out of "5%"

Brian,

bdf |sed 's/%//g' should do the trick.


Pete

Pete
H.Merijn Brand (procura
Honored Contributor

Re: how to remove "%" out of "5%"

# bdf | tr -d '%'
# bdf | sed 's/%//g'
# bdf | perl -pe's/%//g'
# bdf | perl -pe'y/%//d'

enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
RAC_1
Honored Contributor

Re: how to remove "%" out of "5%"

bdf|tr -d "%"
your_script|awk -F "%" '{print "what_you_want"}'
There is no substitute to HARDWORK
royalsun
Occasional Advisor

Re: how to remove "%" out of "5%"

HI ,

You can also use sed to remove the "%" as shown :

echo "500% 600% 700%" | sed 's/%//g'

Regards,

Mille