'for loop' problem!

Hi,

I'm trying to run a process on a load of data. The data is labelled as:

con_3194
con_3367
con_3173
con_3188
etc. (there are about 80 of these files).

And I'm trying to run a process called 'fslswapdim' so this process runs on all the files! Currently, I'm processing each file alone by doing:

fslswapdim con_3194 -z -x y con_3194_swapdim
fslswapdim con_3367 -z -x y con_3367_swapdim

But I would like to learn how to make a loop so they all can be processed at once.

Can anybody help me do this please? I think it's something like

for i in con_* ; do fslswapdim -z -x y con_$i_swapdim; done;

Everything I'm trying is wrong!

Thank you!

use the '&' to run it in background

for i in con_* ; do fslswapdim -z -x y con_$i_swapdim &; done

But you must ensure your con_* list is not too heavy as well as the load generated by one fslswapdim process.
By the way you should also check that their are no restriction about running your fslswapdim process in parallel.

Thanks.

But the & doesn't let me run the process on all the files.

I have got this far -

for i in con_3197 con_1233 con_4431 con_4216 ; do fslswapdim $i -z -x y $i; done;

But I need to add _swapdim to the end of the file! That is the issue now!

Thanks.

Which shell are you running?
enclose your $i with double quote

Since i don't know about your command fslswapdim, i assume you use it with the correct arguments...so if you are not sure about it, double check it
Give a try with:

 for i in con_* ; do fslswapdim "$i" -z -x "$i"_swapdim &; done

Not sure about the shell (ssh?!).

I tried to no avail. I just need to add the word swapdim after my output file.