1
SERVER:~ # zcat /var/log/wtmp-20130827.gz | last -f -
last: -: No such file or directory
SERVER:~ # 

Without uncompressing the wtmp file, how can I see the output of if it with the last command?

2 Answers 2

0

last doesn't support reading from a pipe. You can use /dev/stdin as a file name, but that's kind of useless since it only works if you're redirecting from a file in the first place.

Uncompress the file to a temporary file.

wtmp=$(mktemp)
zcat /var/log/wtmp-20130827.gz >|"$wtmp"
last -f "$wtmp"
rm -f "$wtmp"

Zsh has a form of process substitution =(…) which puts the output of a command in a temporary file.

last -f =(zcat /var/log/wtmp-20130827.gz)
0

No way.

last(1) is not designed to be able to read stdin. Either /var/log/wtmp or -f xxx

It doesn't support '-'

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.