linux、unix中的批量文件重命名
发表于:2024-10-01 作者:千家信息网编辑
千家信息网最后更新 2024年10月01日,我要把gzip压缩后的文件的后缀.gz去掉:方法一:[root@test mysql]#touch test1 test2 test3[root@test mysql]#gzip *[root@tes
千家信息网最后更新 2024年10月01日linux、unix中的批量文件重命名我要把gzip压缩后的文件的后缀.gz去掉:
方法一:
[root@test mysql]#touch test1 test2 test3
[root@test mysql]#gzip *
[root@test mysql]#ls
test1.gz test2.gz test3.gz
[root@test mysql]#ls -l *.gz|xargs rename .gz ""
[root@test mysql]# ls -l *.gz
ls: *.gz: 没有那个文件或目录
[root@test mysql]ls
test1 test2 test3
这个方法在HP-unix中会提示xargs的参数rename是无效的,怎么办呢,别急,请看下一个方法。
方法二:
[root@test mysql]#touch test1 test2 test3
[root@test mysql]#gzip *
[root@test mysql]#ls
test1.gz test2.gz test3.gz
[root@test mysql]#ls -l *.gz |awk '{oldname=$9;sub(/.gz$/,"");print oldname,$9 }'|xargs -n2 mv
[root@test mysql]#ls *.gz
ls: *.gz: 没有那个文件或目录
[root@test mysql]#ls
test1 test2 test3 注:这里传给xargs的参数-n2是关键,它指示xargs每次从标准输入中取出两个Field,传递给待执行的命 令作为参数。否则它会一直从标准输入中取,一直取到命令行刚好不超过LINE_MAX为止。 ok,第二种方法解决了在hp-unix中的批量文件重命名问题;
方法一:
[root@test mysql]#touch test1 test2 test3
[root@test mysql]#gzip *
[root@test mysql]#ls
test1.gz test2.gz test3.gz
[root@test mysql]#ls -l *.gz|xargs rename .gz ""
[root@test mysql]# ls -l *.gz
ls: *.gz: 没有那个文件或目录
[root@test mysql]ls
test1 test2 test3
这个方法在HP-unix中会提示xargs的参数rename是无效的,怎么办呢,别急,请看下一个方法。
方法二:
[root@test mysql]#touch test1 test2 test3
[root@test mysql]#gzip *
[root@test mysql]#ls
test1.gz test2.gz test3.gz
[root@test mysql]#ls -l *.gz |awk '{oldname=$9;sub(/.gz$/,"");print oldname,$9 }'|xargs -n2 mv
[root@test mysql]#ls *.gz
ls: *.gz: 没有那个文件或目录
[root@test mysql]#ls
test1 test2 test3 注:这里传给xargs的参数-n2是关键,它指示xargs每次从标准输入中取出两个Field,传递给待执行的命 令作为参数。否则它会一直从标准输入中取,一直取到命令行刚好不超过LINE_MAX为止。 ok,第二种方法解决了在hp-unix中的批量文件重命名问题;
方法
文件
参数
标准
目录
输入
两个
关键
后缀
命令
怎么办
我要
指示
请看
问题
提示
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
应用数据库的主要目的是
悉尼大学软件开发
浙江云客网络技术
无线网络技术红黑联盟
邮箱服务器配置
华三服务器库存
邮件服务器的配置与管理报告
数据库oem总提示错误消息
网络数据库应用技术最新版
万方数据库应用和数据库一样吗
服务器报警灯含义及处理办法
超微服务器bios设置带外
网络安全俱乐部口号
联想服务器2021年价格走势
大数据云服务器如何运营
网络安全技术前沿
背景数据库修复得多长时间
网络技术公司政策补贴
初中学计算机网络技术
怎么用电脑本地连接服务器
网络安全最高职位
数据库转化长excel
信息网络安全第3时代
海口智能边缘计算服务器如何挑选
服务器换了系统登不上了
软件开发维权
计算机网络技术专业特长
数据库被清空
edc数据库设计
济南商迅网络技术有限公司