简体   繁体   English

tcsh 中的数值范围

[英]numeric range in tcsh

Suppose I have a bunch of files, the names of which contain a number, like this: xxx_1.txt, xxx_2.txt, ... xxx_42.txt假设我有一堆文件,其名称包含一个数字,像这样:xxx_1.txt, xxx_2.txt, ... xxx_42.txt

In bash, it's easy to operate on subsets of these files, eg ls xxx_{1..33}.txt xxx_{35..41} .在 bash 中,很容易对这些文件的子集进行操作,例如ls xxx_{1..33}.txt xxx_{35..41}

What would be the tcsh analog of this? tcsh 的类似物是什么?

As far as I know there is no built-in mechanism to specify range patterns (except single character ranges) in tcsh .据我所知,在tcsh中没有指定范围模式(单个字符范围除外)的内置机制。 But you could, for example, use the seq utility (if it is available) together with sed :但是,例如,您可以将seq实用程序(如果可用)与sed一起使用:

ls `(seq 1 33; seq 35 41)|sed 's/^/xxx_/;s/$/.txt/'`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM