I need some solution to replace some string. I Have a "file" with this on the content:
23674, ICMP ping, OK, 1, 2016-08-25 17:11:02
23686, Ping, OK, 1, 2016-08-25 16:05:04
23689, SSH Service, OK, 1, 2016-08-25 16:05:49
23693, System Free Space, OK, 97.9560, 2016-08-25 16:06:49
23713, System Free Space, OK, 88.0078, 2016-09-20 18:02:22
23745, C:\ Free, OK, 63.2227, 2016-09-21 10:57:03
I used this code to take "Free" value on it like this:
grep Free file.txt |grep OK | cut -d K -f 2 |cut -d , -f 2 |cut -d . -f 1
Then i got this result:
97
88
63
I need to insert "%" into the result using this code:
grep Free rs.txt |grep OK | cut -d K -f 2 |cut -d , -f 2 |cut -d . -f 1 |sed 's/$/%/g'
The result like this:
97%
88%
63%
My question is, how to replace the value on the file for example "97.9560" with new result "97%" etc.
Kindly give me an advice.
Thanks