Mike
Mike

Reputation: 2376

How to grep all text after a certain point

I have the following output from the uptime command:

14:48:51 up 23:34,  2 users,  load average: 0.00, 0.00, 0.00

Although I would like all text after "14:48:51 up 23:34, 2 users, load average:" e.g.:

0.00, 0.00, 0.00

Upvotes: 0

Views: 1314

Answers (3)

SirGeeks
SirGeeks

Reputation: 11

Alternatively, you can just look in /proc/loadavg to get the same information.

awk '{print $1,$2,$3}' /proc/loadavg

Upvotes: 1

fyr
fyr

Reputation: 20859

As alternative you may be better of with sed e.g.

uptime | sed -e 's/.*average: //g'

or

uptime | sed -e 's/.*average: \(.*\)$/\1/g'

Upvotes: 1

Raghuram
Raghuram

Reputation: 3967

You can do like this

<your grep command> | cut -d':' -f5

This will give the output you require

Upvotes: 0

Related Questions