I have 100s of files in a directory with the following naming convention.
00XYZCD042ABCDE20141002ABCDE.XML
00XYZCC011ABCDE20141002.TXT
00XYZCB165ABCDE20141002ABCDE.TXT
00XYZCB165ABCDE20141002ABCDE.CSV
I want to rename these files using bash
, awk
, cut
, sed
, so that I get the output:
XYZCD042.XML
XYZCC011.TXT
XYZCB165.TXT
XYZCB165.CSV
So basically, remove the first two 0s always, and then keep everything until ABCDE starts and then remove everything including ABCDE and keep the file extension.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…