Working on files with names containing arbitrary indices in shell
Hi,
I want to run a command in bash on files with names as file0001.txt, file0002.txt, file0003.txt and so on. The indices I have to work on are arbitrary like from file0009.txt to file0161.txt. So basically I want a string that can be updated from 0009 to 0010 to 0011 and so on. How can I do this?
I had to do something similar in g++. I did it in the following way:
Can I do something analogous in shell?
Thanks in advance!
Last edited by methyl; 06-22-2012 at 09:16 AM..
Reason: Please use code tags
I'm sorry if I wasn't clear. I want a string. I want a string that one can somehow vary from file0009.txt to file0161.txt. I want to use this string in a lot of places.
I would like to list all the .c and .h files in the current directory or any of its subdirectories.
I tried ls -R *.c *.h or ls -R | *.c *.h but that doesn't work.
A related question : how to copy all the .c and .h files in the current directory or any of its subdirectories into another... (3 Replies)
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Hi Folks,
Could anyone please point me to the right direction as I have spent so much time on this without luck. :wall:
I have installed Bind on my CentOS 5 server for internal network. The name resolution is working from the server itself only but not from the clients.
--------------... (7 Replies)
Hello forum,
I am new to shellscripting.
My first goal is to write a script that verifies that for each file in one path there is an associated one in another path.
The association is deviated by a distinct 'part' of the filename(s). Therefore I wanted to work with substitution.
Here is... (3 Replies)
I have an two arrays. One array BINDIST consists of fences. I have another array XOFFS.
Eg
BINDIST = 0 10 20 30 40 50 60
XOFFS = 2 3 4 23 25 28 55 58
I want to find to find the indices of values in XOFFS that are closest to each BINDIST.
My idea is to do as follows
I create array... (7 Replies)
I have an array of distances and a len, for example
len = 323
dist =
I want to calculate the start and end index values around each distance in the array with a length of len from it. Values in dist are stored in ascending order. (4 Replies)
I have the following directory structure:
/maindir
/maindir/product1/
/maindir/product1/type1
/maindir/product1/type2
/maindir/product1/type3
/maindir/product2/
/maindir/product2/type1
/maindir/product2/type2
/maindir/product2/type3
/maindir/product2/type4
...
I'm able to traverse... (6 Replies)