批量打印文件最后修改时间出错,救命啊,在线等!
时间:2011-07-17
来源:互联网
find /home/racing_all/ \( -path /home/racing_all/template -type d -o -path /home/racing_all/jcnews -type d \) -prune -o -type f -name '*.htm' -o -name '*.cfm' |xargs stat -t |awk '{print $1 $13 }' > /home/time.txt
报错误stat: invalid option -- i
Try `stat --help' for more information.
stat: invalid option -- j
Try `stat --help' for more information.
stat: invalid option -- i
Try `stat --help' for more information.
stat: invalid option -- m
Try `stat --help' for more information.
stat: invalid option -- 2
Try `stat --help' for more information.
time.txt里面少了几万跳数据
需求:需要得到文件路径和最后修改时间存放在time.txt里面,
类似:
/home/racing_all/static_page/horse9_static/54/5433.htm1309508384
/home/racing_all/static_page/horse9_static/54/5404.htm1309508384
/home/racing_all/static_page/horse9_static/54/5444.htm1309508384
/home/racing_all/static_page/horse9_static/54/5430.htm1309508384
/home/racing_all/static_page/horse9_static/54/5476.htm1309508384
/home/racing_all/static_page/horse9_static/54/5488.htm1309508384
/home/racing_all/static_page/horse9_static/54/5495.htm1309508384
/home/racing_all/static_page/horse9_static/54/5485.htm1309508384
/home/racing_all/static_page/horse9_static/54/5484.htm1309508384
/home/racing_all/static_page/horse9_static/54/5461.htm1309508384
/home/racing_all/static_page/horse9_static/54/5497.htm1309508384
/home/racing_all/static_page/horse9_static/54/5422.htm1309508384
/home/racing_all/static_page/horse9_static/54/543.htm1309508384
/home/racing_all/static_page/horse9_static/54/5452.htm1309508384
/home/racing_all/static_page/horse9_static/54/5483.htm1309508384
/home/racing_all/static_page/horse9_static/54/5462.htm1309508384
/home/racing_all/static_page/horse9_static/54/5412.htm1309508384
/home/racing_all/static_page/horse9_static/54/5428.htm1309508384
/home/racing_all/static_page/horse9_static/54/5411.htm1309508384
最后跟的是文件最后修改时间,但是数据我的shell数据不完整,少了几万条,大侠救命啊!
报错误stat: invalid option -- i
Try `stat --help' for more information.
stat: invalid option -- j
Try `stat --help' for more information.
stat: invalid option -- i
Try `stat --help' for more information.
stat: invalid option -- m
Try `stat --help' for more information.
stat: invalid option -- 2
Try `stat --help' for more information.
time.txt里面少了几万跳数据
需求:需要得到文件路径和最后修改时间存放在time.txt里面,
类似:
/home/racing_all/static_page/horse9_static/54/5433.htm1309508384
/home/racing_all/static_page/horse9_static/54/5404.htm1309508384
/home/racing_all/static_page/horse9_static/54/5444.htm1309508384
/home/racing_all/static_page/horse9_static/54/5430.htm1309508384
/home/racing_all/static_page/horse9_static/54/5476.htm1309508384
/home/racing_all/static_page/horse9_static/54/5488.htm1309508384
/home/racing_all/static_page/horse9_static/54/5495.htm1309508384
/home/racing_all/static_page/horse9_static/54/5485.htm1309508384
/home/racing_all/static_page/horse9_static/54/5484.htm1309508384
/home/racing_all/static_page/horse9_static/54/5461.htm1309508384
/home/racing_all/static_page/horse9_static/54/5497.htm1309508384
/home/racing_all/static_page/horse9_static/54/5422.htm1309508384
/home/racing_all/static_page/horse9_static/54/543.htm1309508384
/home/racing_all/static_page/horse9_static/54/5452.htm1309508384
/home/racing_all/static_page/horse9_static/54/5483.htm1309508384
/home/racing_all/static_page/horse9_static/54/5462.htm1309508384
/home/racing_all/static_page/horse9_static/54/5412.htm1309508384
/home/racing_all/static_page/horse9_static/54/5428.htm1309508384
/home/racing_all/static_page/horse9_static/54/5411.htm1309508384
最后跟的是文件最后修改时间,但是数据我的shell数据不完整,少了几万条,大侠救命啊!
作者: sickcat2004 发布时间: 2011-07-17
回复 sickcat2004
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数字零
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数字零
作者: yinyuemi 发布时间: 2011-07-17
QUOTE:
回复 sickcat2004
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数 ...
yinyuemi 发表于 2011-07-17 15:46
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数 ...
yinyuemi 发表于 2011-07-17 15:46
大侠 没有报错了,但是数据只有几千条啊,find 到的数据是有5万多跳的!,请指教啊!
作者: sickcat2004 发布时间: 2011-07-17
QUOTE:
回复 sickcat2004
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数 ...
yinyuemi 发表于 2011-07-17 15:46
find {你的代码} -print0 |xargs -0 stat -t |awk '{print $1,$13}' # -0 数 ...
yinyuemi 发表于 2011-07-17 15:46
find /home/racing_all/ \( -path /home/racing_all/template -type d -o -path /home/racing_all/jcnews -type d \) -prune -o -type f -name '*.htm' -o -name '*.cfm' |wc -l
有5万多条呢
51259
find /home/racing_all/ \( -path /home/racing_all/template -type d -o -path /home/racing_all/jcnews -type d \) -prune -o -type f -name '*.htm' -o -name '*.cfm' -print0 |xargs -0 stat -t |wc -l
只有9985条了
9985
作者: sickcat2004 发布时间: 2011-07-17
回复 sickcat2004
这个原因不大清楚,另外,关于stat 加awk部分可以用下面的代替,避免文件名中有空格时,awk代码部分的结果会出错
stat -c "%n %Z"
这个原因不大清楚,另外,关于stat 加awk部分可以用下面的代替,避免文件名中有空格时,awk代码部分的结果会出错
stat -c "%n %Z"
作者: yinyuemi 发布时间: 2011-07-17
QUOTE:
回复 sickcat2004
这个原因不大清楚,另外,关于stat 加awk部分可以用下面的代替,避免文件名中 ...
yinyuemi 发表于 2011-07-17 16:14
这个原因不大清楚,另外,关于stat 加awk部分可以用下面的代替,避免文件名中 ...
yinyuemi 发表于 2011-07-17 16:14
看来只能先把文件路径写到硬盘,再用shell循环遍历文件内容来产生文件最后修改时间了。。。555
作者: sickcat2004 发布时间: 2011-07-17
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28