slt开关:7z仅列出文件名|slt:7z lists only filenames|grep+awk/sed
Only 文件名 awk grep sed 列出 开关 7z
2023-06-13 09:12:25 时间
解决方法Solution
7z+grep+awk:
7z l -slt lang.7z | grep "^Path = " | awk '{print $3}'
7z+grep+sed:
7z l -slt lang.7z | grep "^Path = " | sed 's/^Path= //g'
以下为探索过程
引言Introduction
使用7zip命令行工具7za/7z时遇到一个问题,只列出归档内容的文件名? How to use 7zip command line version tool for listing only filenames?
低调的-slt开关 -slt switch with a low profile
让我试试看. Let's have a try.
7z l -slt lang.7z | more
这样一行行输出文件信息,空行分隔不同文件,十分利于grep,awk提取文件名等信息. This command displays file info one item per line such as path, size, etc. And an empty line is displayed between two different files as separator. It is now more convenient for grep and awk to parse.
把输出重定向到grep "^Path = "命令.Let's redirects the output to command grep "^Path = " with a pipe '|'.
awk:
7z l -slt lang.7z | grep "^Path = " | awk '{print $3}'
sed:
7z l -slt lang.7z | grep "^Path = " | sed 's/^Path= //g'
相关文章
- Only Train Once:微软、浙大等研究者提出剪枝框架OTO,无需微调即可获得轻量级架构
- ORA-01640: cannot make tablespace read-only with changes by in-doubt transactions ORACLE 报错 故障修复 远程处理
- ORA-19723: Cannot recreate plugged in read-only datafile string ORACLE 报错 故障修复 远程处理
- ORA-21523: functionality not supported by the server (object mode only) ORACLE 报错 故障修复 远程处理
- ORA-22278: must update the LOB only through the LOB buffers ORACLE 报错 故障修复 远程处理
- ORA-25122: Only LOCAL bitmap indexes are permitted on partitioned tables ORACLE 报错 故障修复 远程处理
- ORA-25136: this cluster can contain only one table ORACLE 报错 故障修复 远程处理
- ORA-27455: Only “SYS” is a valid schema for a string. ORACLE 报错 故障修复 远程处理
- ORA-39710: only connect AS SYSDBA is allowed when OPEN in UPGRADE mode ORACLE 报错 故障修复 远程处理
- MySQL Error number: 4051; Symbol: ER_WARN_AUDIT_LOG_FORMAT_UNIX_TIMESTAMP_ONLY_WHEN_JSON; SQLSTATE: HY000 报错 故障修复 远程处理
- ORA-01197: thread string only contains one log ORACLE 报错 故障修复 远程处理
- ORA-01783: only one RECOVERABLE or UNRECOVERABLE clause may be specified ORACLE 报错 故障修复 远程处理
- ORA-14635: only one resulting subpartition can be specified for MERGE SUBPARTITIONS ORACLE 报错 故障修复 远程处理
- MySQL Error number: MY-013805; Symbol: ER_WARN_REPLICA_GTID_ONLY_AND_GTID_MODE_NOT_ON; SQLSTATE: HY000 报错 故障修复 远程处理
- PostgreSQL 25006: read_only_sql_transaction 报错 故障修复 远程处理
- MySQL错误提示:sql_mode=only_full_group_by完美解决方案