Unix shortcuts
https://docs.rc.uab.edu/
Please use the new documentation url https://docs.rc.uab.edu/ for all Research Computing documentation needs.
As a result of this move, we have deprecated use of this wiki for documentation. We are providing read-only access to the content to facilitate migration of bookmarks and to serve as an historical record. All content updates should be made at the new documentation site. The original wiki will not receive further updates.
Thank you,
The Research Computing Team
Unix scripting will save you time in the long run. Really!
To do the same command, like zcore, for example, on a bunch of files, doing this in the command line, use a command like this: for i in `ls -1 *.nii`; do echo $i; zscore.pl -i $i; done More complicated versions in a script: ext=’gz’ log=/dev/null; for i in `ls -1 *.$ext 2>$log`; do NAME=`basename $i .$ext`; echo “File: $NAME” ;echo “Moving $NAME.$ext to $NAME.$newext”; done
if you want to do more complicated things, changing names, for example, resort to perl. also, FYI, you can run a perl command in a single line on the command line. This is good for regular expression matching: name=`echo $FILENAME | perl -p -e ’s/(.+)\.gz/$1/i’`