I have hundred of folders, some with with tar.gz files and some with bam files. I just wanted to extract tar.gz files into a different directory. Folders with tar.gz files looks like mentioned below:
d1017f74-3a39-4427-af57-273e34247b49
├──--- UNCID_2207021.7b9569bc-f513-4b64-9a7c-7bb53b9be79b.110801_UNC12-SN629_0115_BD0DVEABXX_3_ACAGTG.tar.gz
5e2d5c52-596f-49bc-967c-42129abbacbf
├──--- UNCID_2208720.71b58051-3bf8-4dfb-a431-c8aceab7c799.110608_UNC13-SN749_0073_BD0CV8ABXX_2.tar.gz
2ef74f93-5da2-454c-aca2-d86c289eacb8
├──--- UNCID_2206802.25be50e7-7705-492d-a44a-0e40180d10c8.110901_UNC12-SN629_0127_BC025UABXX_1_CTTGTA.tar.gz
e01ca3e0-beb0-46b7-bb7c-f5b16f966918
├──--- UNCID_2521679.d817dcee-1322-4949-a6e9-138447e6fc56.140417_UNC13-SN749_0343_BC41HBACXX_5_CTTGTA.tar.gz
992a7083-28ce-4857-898e-9d4b4fbf2fa1
├──--- UNCID_2319278.bf92b8cc-9a5c-4e96-917c-c264fe588f8d.131118_UNC12-SN629_0336_AC31D0ACXX_5_ACTTGA.tar.gz
For extracting tar.gz files into a target directory I have used following command:
find /path/to/directory -name '*.tar.gz' -execdir tar -C /path/to/targetdirectory -xzvf '{}' \;
This command gives output fastq files for some tar.gz files with names like below:
110801_UNC12-SN629_0115_BD0DVEABXX.3_1.fastq
110801_UNC12-SN629_0115_BD0DVEABXX.3_2.fastq
110608_UNC13-SN749_0073_BD0CV8ABXX.2_1.fastq
110608_UNC13-SN749_0073_BD0CV8ABXX.2_2.fastq
110901_UNC12-SN629_0127_BC025UABXX.1_1.fastq
110901_UNC12-SN629_0127_BC025UABXX.1_2.fastq
This is not what I want. There is a text file with Foldernames, tar.gz file names, sample names like following:
FolderNames Tar.gz files SampleNames
d1017f74-3a39-4427-af57-273e34247b49 UNCID_2207021.7b9569bc-f513-4b64-9a7c-7bb53b9be79b.110801_UNC12-SN629_0115_BD0DVEABXX_3_ACAGTG.tar.gz S-E9-A1NA-11A
5e2d5c52-596f-49bc-967c-42129abbacbf UNCID_2208720.71b58051-3bf8-4dfb-a431-c8aceab7c799.110608_UNC13-SN749_0073_BD0CV8ABXX_2.tar.gz S-AO-A12H-01A
2ef74f93-5da2-454c-aca2-d86c289eacb8 UNCID_2206802.25be50e7-7705-492d-a44a-0e40180d10c8.110901_UNC12-SN629_0127_BC025UABXX_1_CTTGTA.tar.gz S-AC-A23E-01A
e01ca3e0-beb0-46b7-bb7c-f5b16f966918 UNCID_2521679.d817dcee-1322-4949-a6e9-138447e6fc56.140417_UNC13-SN749_0343_BC41HBACXX_5_CTTGTA.tar.gz S-C8-A8HR-01A
992a7083-28ce-4857-898e-9d4b4fbf2fa1 UNCID_2319278.bf92b8cc-9a5c-4e96-917c-c264fe588f8d.131118_UNC12-SN629_0336_AC31D0ACXX_5_ACTTGA.tar.gz S-A8-A08A-01A
Output should get sample name from text file and should look like below:
S-E9-A1NA-11A.3_1.fastq
S-E9-A1NA-11A.3_2.fastq
S-AO-A12H-01A.2_1.fastq
S-AO-A12H-01A.2_2.fastq
S-AC-A23E-01A.1_1.fastq
S-AC-A23E-01A.1_2.fastq
S-C8-A8HR-01A.5_1.fastq
S-C8-A8HR-01A.5_2.fastq
S-A8-A08A-01A.5_1.fastq
S-A8-A08A-01A.5_2.fastq
No comments:
Post a Comment