-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRename_PE.sh
57 lines (41 loc) · 1021 Bytes
/
Rename_PE.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# Author: Patricia Agudelo-Romero
# email: [email protected]
# This script will help to rename different styles of PE fastq files to dir/name_R1.fastq.gz and dir/name_R2.fastq.gz
# Run the script in the directory were the files are placed
dir="$PWD"
echo "${dir}"
echo "----- fq.gz -----"
for f1 in ${dir}/*fq.gz
do
echo "${f1}"
new_name=$(echo "$f1" | sed 's/.fq.gz/.fastq.gz/')
mv $f1 $new_name
echo "${new_name}"
done
echo "----- _001.fastq.gz -----"
for f1 in ${dir}/*fastq.gz
do
echo "${f1}"
new_name=$(echo "$f1" | sed 's/_001.fastq.gz/.fastq.gz/')
mv $f1 $new_name
echo "${new_name}"
done
echo "----- _1.fastq.gz -----"
for f1 in ${dir}/*_1.fastq.gz
do
echo "${f1}"
new_name=$(echo "$f1" | sed 's/_1.fastq.gz/_R1.fastq.gz/')
mv $f1 $new_name
echo "${new_name}"
done
echo "----- _2.fastq.gz -----"
for f1 in ${dir}/*_2.fastq.gz
do
echo "${f1}"
new_name=$(echo "$f1" | sed 's/_2.fastq.gz/_R2.fastq.gz/')
mv $f1 $new_name
echo "${new_name}"
done
echo "====="