Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to batch process some files. So far I have used only single files, using
for i in ax bx cx dx nx etc...
do
command1 (e.g. /../test$i)
command2 (e.g. /../test$i)
done
I have files that need to be "coupled".
e.g. ax with dx, bx with cx, nx with nnx, ....
all this is in a fairly random order and I have a table/matrix with the filenames coupled. They have to be processed together before going to the next one, and I can't figure out how to do it.
e.g. commands will look like
command1 ../../test/ax/dx
command2 ../../test/ax/dx
where the loop then should jump to
command1 ../../test/bx/cx
command2 ../../test/bx/cx
Basically I need to use 2 linked variables in one command line, repeat a few commands with this set of variables. Then next 2 variables need to go through the same set of commands are unrelated to the first 2, etc.
With "for i in..." I have been able to do this type of a loop with a single variable, but combining multiple sets of 2 linked variables within one loop I have not been able to figure out.
Hope that clarifies it better, not sure how better to put it. Thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.