我想用last -f命令读取我从/var/log/复制的日志,并将它们添加到一个.txt文件中。问题是目录中有多个wtmp文件,我想将它们全部添加到.txt文件中。我的代码无法工作,因为只有一个wtmp文件将被添加到该文件中。以下是我到目前为止所做的工作:
cp /var/log/wtmp*.xz ~/test #copy the .xz archives
unxz -d ~/test/*.xz #unzip the archives
last -f ~/test/wtmp* >> ~/test/log.txt
#add the content of the unzipped archives to a new .txt file(this line doesn't work properly) 我希望有人能帮助我!
问候
发布于 2015-12-17 04:03:38
你能做到吗?
for i in ~/test/wtmp*; do
last -f $i >> ~/test/log.txt ;
donehttps://stackoverflow.com/questions/34318682
复制相似问题