The Find Command
I come from a systems background in Windows and Linux, maintaining operations and writing programs in C. Since I bring that perspective to my TM1 work, I’m more comfortable with command line tools than some of my other teammates, so I thought I would share some tips.
As an example, let’s look at a large file of actuals. A customer’s file is over 1GB in size and has over six million rows, but Excel can only load one million rows. The file is also too large to be loaded into Notepad++ or other common tools. To research an issue with this file, I probably only need a small number of records that affect a particular cost center or model number.
With a command like:
find “HOU00884500” actuals.txt >smallfile.txt
I can reduce my large file of actuals down to 414 lines in about two minutes, and then use another tool such as Excel to analyze the results (smallfile.txt).
Example
Here is a more detailed example. The Find command can be used in Windows Command Prompt or Powershell. I’ll use the command prompt window for this example.
Start the Windows Command Prompt. One way to do this is to click on the search magnifying glass on the task bar and type in “cmd” (without the quotes) and hit <Enter>.
The default directory will normally be a directory you have write access to, such as “C:USERSKPORTER” but you may need to switch to a different drive and path.
To switch to a different drive, such as the F: drive, just enter the drive letter and : and press <Enter>.
To go to a particular path, use the CD (change directory) command, such as “CD SOURCEDATAEXAMPLE”. The target directory must already exist or you will get an error.
Running the Find
Now build the command:
find “HOU00884500” actuals.txt >smallfile.txt
In place of the filename actuals.txt, you can drag a file from a Windows Explorer window onto the command prompt window. This will insert the full path of the file, so it may look like (bold added for emphasis):
find “HOU00884500” C:DATADIRactuals.txt
This command will display the results to the screen. If you want to capture the results in a file to view them in an editor or Excel, use the > command to redirect to another file. This file will be created in your current directory if you don’t specify otherwise:
find “HOU00884500” C:DATADIRactuals.txt > smallfile.txt
When searching TM1 log files, you may have a ” (quote) character that needs to be included in your actual search string. To do this, make any ” character that is part of the search string a double quote, “”. This example will search all the events where the Load Data process completed successfully so you can compare execution times over the timespan of the log:
find “Process “”Load Data””: finished” C:SERVERLogstm1server.log
Wrapping Up
As you can see, there is a lot of flexibility with the tool, but some uses of it can get pretty complicated. Don’t be intimidated, though. You can get a lot of value from even just these simple uses.
Let me know in the comments if you have any questions or suggestions. Is there a similar tool available in the Windows GUI? I know how to search, but I haven’t seen a comparable way to capture the results.
Leave A Comment