tcsh 中的数字范围

发布于 2024-11-18 02:05:38 字数 177 浏览 9 评论 0原文

假设我有一堆文件,它们的名称包含一个数字,如下所示: xxx_1.txt, xxx_2.txt, ... xxx_42.txt

在 bash 中,很容易对这些文件的子集进行操作,例如 ls xxx_{1..33}.txt xxx_{35..41}

与此类似的 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

In bash, it's easy to operate on subsets of these files, e.g. ls xxx_{1..33}.txt xxx_{35..41}.

What would be the tcsh analog of this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美人如玉 2024-11-25 02:05:38

据我所知,tcsh 中没有内置机制来指定范围模式(单字符范围除外)。但是,例如,您可以将 seq 实用程序(如果可用)与 sed 一起使用:

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

As far as I know there is no built-in mechanism to specify range patterns (except single character ranges) in tcsh. But you could, for example, use the seq utility (if it is available) together with sed:

ls `(seq 1 33; seq 35 41)|sed 's/^/xxx_/;s/$/.txt/'`
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文