CALAR ALTO UTILITIES

 

 FIT: Find IT. The utility allows you to find strings into all the files below a given directory, including all subdirectories. It will search that string starting from the given directory and going down through all the directory tree below the given one.

Syntax: fit <pattern> <directory> [exclude_file] [i] [a]

<pattern>

Mandatory. This is the string to be found. If it is only one word, it can be without quotes, but if the string has more than one word (a phrase), then it MUST be enclosed on quotes.

<directory>

Mandatory. This is the directory to start with. The program will first check in this directory and then it will go deep into the directory tree below this one.

[exclude_file]

Optional. This is our own exclude_file. Please, see below for an "exclude files" explanation. If this argument is present, it MUST be the 3rd argument (after pattern and directory), and then , the optional argument 'a' is ignored if given.

[a]

Optional. If present, and our exclude file argument is not, no exclude file will be used. Please, see below for a detailed explanation of "exclude files".


[i]
Optional. Normally (without this option), the program diferenciates between uper and lower case. If this parameter appears on the command line, then no diferentiation will be consider, so "Pepe" will be the same as "pepe"

Exclude Files:

This program is thought for looking for ascii strings. There are several type of files that normally do not have readable ascii strings inside. Among others, gif, jpeg, compressed files like Z or gz and so on. Usually those files are big, so looking inside them is a waste of time. By default fit program will not look inside files which types are one of those on a file called "/mpiwork/caha/bin/FIT_EXCLUDE". This is the default behaviour. But this can be override with two excluyent arguments. If the 3rd argument is a file name, the program will use that file name instead of "/mpiwork/caha/bin/FIT_EXCLUDE". Of course, the file name must exist and have a good syntax. That file can be named as you like, with the exception of two names: "a" and "i" which are valid arguments. If the 3rd argument is not a file name but this argument or the 4th argument is "a" then fit won't exclude any file. Beaware when using this option.

Examples of exclude files:

The syntax is very simple. One exclusion per line. So a valid example file can have next lines:

*.gif
*wwf
file.dat
mydir

The first line will exclude all files ending with .gif . Next line will excluded all files ending with  wwf . Third line will exclude all files called file.dat , or will not enter into a directory called file.dat . And last line will do the same as previous one.

So, as you can see, if you want to exclude a directory, you can do it by including its name into your own exclude file.

Examples of fit command:

fit "Welcome Home" /mydisk/mydir i Will look for "Welcome Home" below "/mydisk/mydir" (and subdirectories) and will find all the uper/lower case variations of the above string (because of the "i" argument). This command will read "/mpiwork/caha/bin/FIT_EXCLUDE" file in order to exclude all the files/directories and type of files contained in it
fit "Welcome Home" /mydisk/mydir The same as above but will take into account the case. So "welcome home" will not match.
fit welcome /mydisk/mydir a Will look for "welcome" string under /mydisk/mydir (and subdirectories) and it won't exclude any file
fit welcome /mydisk/mydir i a Same as above but with no case diferentiation
fit welcome /mydisk/mydir a i Same as above
fit welcome /mydisk/mydir myfile a i In this case, the exclude argument "myfile" will be the one used, ignoring the "a" argument. The command will exclude all those files/directories and file types appearing on "myfile" file. The "i" argument has the same effect as before.