Artificial intelligent assistant

Remove strings of a filename and leave others in BASH I have a lot of files like this: 2007.365.00.00.00.0000.9A.CVSV4..HHZ.D.SAC.GAP.decim10.GAP In the end I want it like: 2007.365.00.00.CVSV4.HHZ.SAC I tried this: for file in /home/joana/Desktop/*GAP; do mv "$file" `echo "$file" | sed -e 's/00.0000.9A.//' -e 's/.D//' -e 's/.GAP.decim10.GAP//'`; done Anda I get this: mv: cannot move ‘/home/joana/Desktop/2007.365.00.00.00.0000.9A.CVSV4..HHZ.D.SAC.GAP.decim10.GAP’ to ‘/home/joanaesktop/2007.365.00.00.CVSV4..HHZ.D.SAC’: No such file or directory Anyone can help me? I saw a lot of examples but I am probably doing something wrong.

if you are happy with the output, then remove the echo (before the mv)


for file in *GAP
do
NEW_FILE=$(echo ${file} | awk -F. '{print $1,$2,$3,$4,$8,$10,$12}' OFS=.)
echo mv ${file} ${NEW_FILE}
done

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f83fa12e8021f03f2f358f84d3449611