glob - ZSH: how to repeat argument together with expanded filenames -


so i'm neuroimager , want open large number of files. example:

fslview t1.nii.gz _coil_8/run1.nii.gz _coil_8/run2.nii.gz _coil_32/run1.nii.gz _coil_32/run2.nii.gz  

so can easier using glob expression in zsh follows:

fslview t1.nii.gz _coil_*/*.nii.gz (<tab>/<enter>) 

however, want add additional colormap range expanded files, so:

fslview t1.nii.gz _coil_8/run1.nii.gz -b 300,1500 _coil_8/run2.nii.gz  -b 300,1500_coil_32/run1.nii.gz -b 300,1500 _coil_32/run2.nii.gz -b 300,1500 

how there?

fslview t1.nii.gz _coil_*/*.nii.gz -b 300,1500 (<tab>/<enter>) 

doesn't work: add -b argument last filename...

you can replace each file file , range parameter, , pass fslview using xargs:

ls _coil_*/*.nii.gz | sed 's/$/ -b 300,1500/' | xargs fslview 

if there lot of files, might run problems if xargs breaks separate commands in wrong place. can try xargs echo fslview first see if it's going broken up. can intentionally break 1 call per file, using xargs -n 3 fslview


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -