The appeal of Finder is that it is so natural to open a file, even one chosen at random, by double-clicking it, to see its contents and figure out where my code has gone wonky
Many times
open filename.extension
will automatically open the correct application, as if you had double clicked on it.
If you need to force a specific application, and default for the .extension is not that app, then you would include the -a Application option, as in:
open -a LibraOffice filename.extension
You said
I'm doing text analysis and extracting specific bits of information from files that all contain the same info but are not all formatted the same way)
If the files are plain text or at least the strings you are looking for are plain text, then you can use lots of different tools in the terminal to search the files. 'grep' is a great tool for searching a large number of files to look for unique strings.
And because you have a very large number of files that may overwhelm the command line length limits, you could do something like:
Type 'cd' and a space
Drag and drop the folder icon from the Finder to the Terminal session
Press return.
The terminal session's current working directory, is the Folder you are interested in.
Now:
ls -f | grep -i 'filename_pattern_you_are_interested in' | xargs grep -i -l 'pattern_in_files_you_are_looking_for'
- This command will list the names of all the files that contain the pattern you are looking for.
- The 1st 'grep' will select the subset of files that have a specific pattern in the file name.
- The 2nd 'grep' will search the contents of each file looking for the pattern you are interested in.
- The 'xargs' command will invoke the 2nd 'grep' multiple times, each time with a subset of the file names it reads from its side of the pipe, but not so many that the command line gets too long. It is a very efficient way of processing lots of files without exceeding the command line length
- The -l (dash lowercase L) in the 2nd 'grep' tells 'grep' to just show the file name if it contains the pattern in the file. If you want to actually see what lines it found in the file that match your pattern, then remove the -l
- The -i in both 'grep's says to ignore upper/lowercase. Often makes it easier to find things.
Grep accept regular expressions. If you do not understand regular expressions, then know that just using simple a-z, 0-9 is good enough for many things.
NOTE: Most people with a lot less files in a directory would actually just use:
grep -i -l 'search_pattern' company*
My example line above is only because you have so many files in a single directory, that wildcard file name expansion would most likely put so many files on the command line, it would overflow the maximum length allowed on a command line.
Now if you know things like perl, awk, python, or other scripting language that is good at searching files for things, you can have a fantastic time using Terminal sessions to process your files.