Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

numeric range in tcsh

Tags:

shell

unix

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?

like image 733
ev-br Avatar asked Jul 03 '26 22:07

ev-br


1 Answers

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/'`
like image 133
bmk Avatar answered Jul 11 '26 04:07

bmk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!