问题描述:

I need to get all users from file, containing information about all loggins within some time interval. (The delimiter is : )

So, I need to get all users from output of command last -f.

I tried to do this:

last -f file| cut -d ":" -f1

but in the output aren't just the usernames. It seems to me like some record take more than just one line and therefore it can't distinguish the records. I don't know.

Could you help me please? I would be grateful for any advice.

网友答案:

You could say:

last -f file | awk '{print $1}'

If you want to use cut, say:

last -f file| cut -d " " -f1
相关阅读:
Top