Linux command line
The main method to remember when starting to use the Linux command line is piping. This means taking the ouput of one command, and sending it to another. The xargs command allows subsequent lines of piped output to be used sequentially as arguments to another function. For instance,
find -name SPM.mat
outputs a list of locations of files named SPM.mat, also searching all subdirectories. Every line of output contains one file location. A common situation is to want to delete all such files. So, for every line, that file should be deleted. This can be done by piping the output to xargs:
find -name SPM.mat | xargs rm
This does the same as manually typing rm ./DoPro2/.../SPM.mat for each and every file found by the find function.
To unzip all .gz files in all subdirectories:
find -name *.gz | xargs gunzip
To simplify the names of all subdirectories:
Unknown! I use Matlab now, e.g.,
x = dir('sc*'); for ix = 1:length(x), c0 = ['mv ' x(ix).name '/*Hand1 ' x(ix).name '/Hand1']; disp(c0); system(c0); end;