![find 명령에서 대체 확장자를 사용하여 파일 이름을 얻는 방법](https://linux55.com/image/115168/find%20%EB%AA%85%EB%A0%B9%EC%97%90%EC%84%9C%20%EB%8C%80%EC%B2%B4%20%ED%99%95%EC%9E%A5%EC%9E%90%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%ED%8C%8C%EC%9D%BC%20%EC%9D%B4%EB%A6%84%EC%9D%84%20%EC%96%BB%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
덱스트란파일을 변환하는 도구입니다. 일반적인 사용법은 입니다 . 확장자 대신 확장자를 사용하여 명령에서 파일 이름을 얻는 dextract -q test.h5 > test.fastq
방법과 같이 find 명령과 어떻게 결합합니까 ?find All_RawData/Each_Cell_Raw/ -name "*.bax.h5" | xargs -I {} dextract -q {} >
>
find
fastq
h5
답변1
이와 같이:
find All_RawData/Each_Cell_Raw -name '*.bax.h5' -exec sh -c 'for f do dextract -q "$f" > "${f%.h5}.fastq"; done' find-sh {} +
더 쉽게 읽을 수 있도록 몇 가지 줄 바꿈이 있습니다.
find All_RawData/Each_Cell_Raw -name '*.bax.h5' -exec sh -c '
for f
do dextract -q "$f" > "${f%.h5}.fastq"
done' find-sh {} +
설명과 근거는 다음을 참조하세요.https://unix.stackexchange.com/a/321753/135943.