Loop to process 2 files with same name in different path
Hello forum members,
I hope you can help me with this I don't know hot to reach.
I have a list of files in "/home/MyPath1/" and in "/home/MyPath2/". The files have the same name in both folders.
(but different content, the content doesn't matter here I think)
/home/MyPath1/
filename1.txt
filename2.txt
filename3.txt
.
.
.
filenameN.txt
/home/MyPath2/
filename1.txt
filename2.txt
filename3.txt
.
.
.
filenameN.txt
I've written a bash script that process a couple of these files at the same time, let say that to get output1.txt the script needs to take
filename1.txt of both folders, then takes filename2.txt of both folders to get output2.txt and so on, the script is as follow:
I want to set a loop that uses as input couple of files from both folders to get one output without enter manually for each process.
The code needs to process filename1 from folder1 and filename1 from folder2 to produce output1, filename2 from
folder1 and filename2 from folder2 to produce output2 and so on.
I need to process both at the same time because the output from file of folder1 is concatenated to output from file
of folder2.
I have the script that does that, but I have to insert path of both files manually.
So, I need a loop process all couples of files from 2 folders and for each process generate its
corresponding output file.
Something like this:
I think the loop as above would work, but with the structure of my code, I don't know how to create an output
(line in red) for each couple of files. I mean, create output1 when the loop processes filename1 from both files
and output2 when loop processes filename2 from both files.
Hope somebody could help me.
Much appreciated in advance.
Last edited by Ophiuchus; 10-09-2011 at 01:21 AM..
I have a folder with files and I have to process them in a loop. However the filenames have space characters, so the list get split.
$ touch "File Number_1"
$ touch "File Number_2"
$ ls "/tmp/File Number"_*
/tmp/File Number_1 /tmp/File Number_2
I tried following (sorry for using the... (3 Replies)
Hi All,
Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created.
/Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt
/Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Please support for this issue,
I have a below process running on my machine
16108 /usr/jdk/instances/jdk1.6.0/bin/java -Xms3072m -Xmx3072m -Dcbcm.root=/java3_app
20992 java -Djob.name=SOME_JOB_IS_RUNNING -Dcbcm.root=/java3_apps1/cbcm_js/j
For PID 16108 I can see that its... (3 Replies)
Dear All,
Please help me in finding solution for below problem.
I need a command or script to get code or path(from which location code is being executed), which is executing under a process ID.
I dont have google access here,Please help me in finding solution.
Thank you. (3 Replies)
I have multiple input files that I want to manipulate using a shell script. The files are called 250.1 through 250.1000 but I only want the script to manipulate 250.300 through 250.1000. Before I was using the following script to manipulate the text files:
for i in 250.*; do
|| awk... (4 Replies)
I need to process a dirtree containing ms office files such that each file is stored as a variable and also, just the file file stem. Why? They will be using as input and output parameters for another script. For example /path/to/second_script -i filename.docx -o filename
Here's what I... (1 Reply)
hi ,
I have certain files at the same path with differeent extensions like .dat , .txt etc ...........i need to rename them with extension .found at the same path with the help of loop....
also the files names will be like this ;
abc_2010_c1.dat
abc_2010_c2.dat
xyz_2010_c1.txt (2 Replies)
Hello everybody !
I have a first program, called "server" which build 2 FIFO's in this way:
...
#define PERMS 0666
#define FIFO1 "\tmp\cerere"
#define FIFO2 "\tmp\raspuns"
...
mkfifo(FIFO1, PERMS)
mkfifo(FIFO2, PERMS)
...
I want to access these FIFO's in a second separate program,... (1 Reply)
hello
i have a requirement where i have a direcotry in which i get files in the format
STOCKS.20080114.dat
STOCKS.20080115.dat
STOCKS.20080117.dat
STOCKS.20080118.dat
i need to loop through the directory and sort by create date descending order and i need to process the first file.
... (1 Reply)