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?
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)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments