파일 이름을 바꾸는 데 도움이 필요합니다.
$ cat q.txt
Only in /aa/bb/home/sh/POC/Backup/DDL/: comp1.txt
Only in /aa/bb/home/sh/POC/Backup/DDL/: comp.txt
Only in /aa/bb/home/sh/POC/Backup/DDL/: junk.txt
Files /aa/bb/home/sh/POC/05_26_2022/DDL/test.demo/table1.txt and /aa/bb/home/sh/POC/Backup/DDL/test.demo_table1.txt differ
Only in /aa/bb/home/sh/POC/05_26_2022/DDL: test.demo_table2.txt
$ cat q.txt | awk '/^Only/ {gsub("[/:]+","/", $3); {sub(/^.*\//, "", $3);print $NF > $3".txt"} /^Files.*differ/ {sub(/^.*\//, "", $2); print $2.txt > "different.txt"}'
현재는 _로 파일 이름을 제공합니다.
ls -lrt
27 May 27 07:02 _aa_bb_home_sh_POC_05_26_2022_DDL.txt
28 May 27 07:02 _aa_bb_home_sh_POC_Backup_DDL_.txt
27 May 27 07:04 different.txt
아래와 같은 o/p가 필요합니다
ls -lrt
27 May 27 07:02 05_26_2022_DDL.txt
28 May 27 07:02 Backup_DDL.txt
27 May 27 07:04 different.txt