[Techtalk] Looping with numbers in filenames
Benjamin M. A'Lee
bma-linuxchix at bma.cx
Tue Feb 15 18:36:46 UTC 2011
At Tue, 15 Feb 2011 16:49:08 +0000, David Sumbler wrote:
> I have some sets of files which have names such as file1.txt,
> file2.txt ... file25.txt.
> I want to perform an operation on all the files:in other words, I need
> to be able to do something like
> for integer = str(1 to 25)
> do something to file$integer.txt
> How can I do this at the bash input?
On GNU-based systems:
for integer in `seq 25`; do
something to file$integer.txt
On BSD/Mac, use "jot" rather than "seq".
(Sorry for the double-post, I sent it from an address which wasn't subscribed.)
More information about the Techtalk