0

我想合并所有在某个位置有一位或两位数字的文件。基本上我想匹配1-22的数字。

我用 bash 写:

cat chr[0-9][0-9]{0,}_from6_new_mono.txt >all_autosomes_from6_new_mono.txt

我收到此错误:

cat: chr[0-9][0-9]0_from6_new_mono.txt: No such file or directory

但是文件名看起来像这样:

chr22_from6_new_mono.txt

或者

chr1_from6_new_mono.txt

有人可以告诉我哪里可能有问题吗?谢谢:)

4

2 回答 2

2

您可以使用bash花括号扩展来表示数字范围:

cat chr{1..22}_from_6_new_mono.txt >merged
于 2012-07-09T10:00:52.550 回答
1

你确定,你正确使用了大括号扩展吗?

查看http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion了解更多信息

于 2012-07-09T09:58:33.583 回答