for file in $(find $DIR -mindepth 3 -type f -name ".interval"); do name=$(basename $file…
- User
for file in DIR -mindepth 3 -type f -name "*.interval"); do
name=file .interval)
name=file | "/(SRR.*)/g") echo $name
mv DIR/$name.bed
- Assistant
It seems you want to rename
.intervalfiles found at a minimum depth of 3 directories under$DIR, extracting a part of their file paths that matches the patternSRR*and using it to rename the files with a.bedextension. However, there is a mistake in your script. Theechocommand is used incorrectly and does not perform pattern matching.Let's correct the script:
bash