Patrick TJ McPhee wrote:
> In article <1194269755.937838.186160@[EMAIL PROTECTED]
>,
> Eliot <ebp@[EMAIL PROTECTED]
> wrote:
> % I want to use the system command "uptime" and then use awk to display
> % just the text I am interested in:-
> % Consider the following three lines of input
> % 18:01:04 up 1 min, 0 users, load average: 0.55, 0.28, 0.10
> % 22:14:47 up 1:01, 0 users, load average: 0.21, 0.05, 0.02
> % 17:58:52 up 1 day, 2:34, 0 users, load average: 0.02, 0.02, 0.00
> % The output for each line should be
> % 1 min
> % 1:01
> % 1 day, 2:34
>
> BEGIN { FS="up |," }
> { print $2 }
>
>
That doesn't cover the OPs requirements (see output line 3).
The FS must be refined, e.g.
BEGIN { FS="up +|, *[0-9]+ users" }
{ print $2 }
Janis


|