I am working on a program that does the following:
Reads 270 file in the folder X and calls another program to run a command with the contents of the file. For example:
$ cat X/1.txt
AAAA
BBBB
CCCC
The program is supposed to read that text (there are 270 of them) and in the loop it's supposed to do:
$python file.py AAAA;
then
python file.py BBBB;
then
python file.py CCCC.
and the move on the next file like 22.txt (the files aren't numeric so a counter wouldn't be much help).
I tried the following:
function text(){
for i in $(ls Domains/);
while read line;
do
$line
f= done < Domains/$i.txt
python file.py $f
}
text;
Thanks, guys!
find
and its-exec
option, that's in the direction of what you want to use.