I have a file.txt with a list of 100 files and their paths. Here are the first 3 entries:
/project/msun/USERS/me/czi/data/lb/MAP-9-003/c44caf4c-cab7-4749-9940-a74a66bceec3/c44caf4c-cab7-4749-9940-a74a66bceec3.bam
/project/msun/USERS/me/czi/data/lb/MAP-9-007/3e5a10e0-3928-40c5-8dfb-9bbe9d5e0105/3e5a10e0-3928-40c5-8dfb-9bbe9d5e0105.bam
/project/msun/USERS/me/czi/data/lb/MAP-9-013/e230fce2-8f54-4d30-bb75-38d11a438f68/e230fce2-8f54-4d30-bb75-38d11a438f68.bam
I want to cp these files, rename the new files and put them in another dir & path, where the new dir name is the dir in the 8th level of the old path, and the new file name = new dir name + file extension. The new dir location also changes. I would get the new files sorted like this:
/project/msun/USERS/me/czi/data/map/MAP-9-003/MAP-9-003.bam #(old c44caf4c-cab7-4749-9940-a74a66bceec3.bam)
/project/msun/USERS/me/czi/data/map/MAP-9-007/MAP-9-007.bam #(old 3e5a10e0-3928-40c5-8dfb-9bbe9d5e0105.bam)
/project/msun/USERS/me/czi/data/map/MAP-9-013/MAP-9-013.bam #(old e230fce2-8f54-4d30-bb75-38d11a438f68.bam)
I found these posts: Using xargs to copy directories and Copy files with certain extension from many nested sub-directories to a single directory and append to each copied file the name of the directory
doing related tasks but I am unable to do my specific task