)
1、分析不能FOR遍历然后mv不好处理2、先 find . -name 8af* fileout ,用sed awk 等文本处理工具处理strsed -i s/001/002/g fileout此时fileout中为替换的target名3、取ary索引, mv一一替换#!/bin/sh ary1( 8a3f460a905e2b7a01906892bf4500ff_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a905e2b7a0190681efa8a00e9_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a902b1fc00190389afbd5011b_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190682f472d00fb_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a019067fe0e3a00d9_SMCPN_REQ_230_01MO_20240601_000_001.doc 8a3f460a905e2b7a0190682eb14000f9_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190682ccb8c00f5_SMCPN_REQ_230_01MO_20240601_000_001.doc 8a3f460a900c51a8019014862a01009d_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a01905e52feab004b_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a01906827f99900ef_SMCPN_REQ_230_01MO_20240601_000_001.docx 8a3f460a905e2b7a01906829b60100f1_SMCPN_REQ_230_01MO_20240601_000_001.docx 8a3f460a905e2b7a0190681de29700e7_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a01905e51bf440049_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a019067fb13dd00d5_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190682dc86200f7_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a01905e570de1004d_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190682a7d3300f3_SMCPN_REQ_230_01MO_20240601_000_001.doc 8a3f460a905e2b7a01906819101d00df_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a905e2b7a0190681bfe2300e3_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190688f605900fd_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a905e2b7a01905e50cd790047_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a01906825368800eb_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a0190681a2d9700e1_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a905e2b7a01906818162100dd_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a905e2b7a01905e500cad0045_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a019067fc1a1700d7_SMCPN_REQ_230_01MO_20240601_000_001.zip 8a3f460a905e2b7a019067fedd0b00db_SMCPN_REQ_230_01MO_20240601_000_001.doc 8a3f460a905e2b7a01906826091400ed_SMCPN_REQ_230_01MO_20240601_000_001.xlsx 8a3f460a90599bde01905de17f961579_SMCPN_REQ_230_01MO_20240601_000_001.zip ) ary2( 8a3f460a905e2b7a01906892bf4500ff_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a905e2b7a0190681efa8a00e9_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a902b1fc00290389afbd5011b_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190682f472d00fb_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a019067fe0e3a00d9_SMCPN_REQ_230_01MO_20240601_000_002.doc 8a3f460a905e2b7a0190682eb14000f9_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190682ccb8c00f5_SMCPN_REQ_230_01MO_20240601_000_002.doc 8a3f460a900c51a8019014862a01009d_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a01905e52feab004b_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a01906827f99900ef_SMCPN_REQ_230_01MO_20240601_000_002.docx 8a3f460a905e2b7a01906829b60100f1_SMCPN_REQ_230_01MO_20240601_000_002.docx 8a3f460a905e2b7a0190681de29700e7_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a01905e51bf440049_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a019067fb13dd00d5_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190682dc86200f7_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a01905e570de1004d_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190682a7d3300f3_SMCPN_REQ_230_01MO_20240601_000_002.doc 8a3f460a905e2b7a01906819101d00df_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a905e2b7a0190681bfe2300e3_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190688f605900fd_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a905e2b7a01905e50cd790047_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a01906825368800eb_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a0190681a2d9700e1_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a905e2b7a01906818162100dd_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a905e2b7a01905e500cad0045_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a019067fc1a1700d7_SMCPN_REQ_230_01MO_20240601_000_002.zip 8a3f460a905e2b7a019067fedd0b00db_SMCPN_REQ_230_01MO_20240601_000_002.doc 8a3f460a905e2b7a01906826091400ed_SMCPN_REQ_230_01MO_20240601_000_002.xlsx 8a3f460a90599bde01905de17f961579_SMCPN_REQ_230_01MO_20240601_000_002.zip ) function deal_(){ len1${#ary1[]} for len in seq 0 $[len1-1] do mv ${ary2[$len]} ${ary1[$len]} let count ; echo ${ary2[$len]} moved $count || echo ${ary2[$len]} mv failed \n done echo rename files: $count if [ $count -eq 29 ]; then echo -e process sussessd! else echo process failed check ! fi } deal_