I have a batch file that does two things and it works but on a 9GB file, it takes forever. Does anyone have any ideas how i can improve this from a batch file? Currently using cut, grep, awk, sed from GNU.
The %File_IN% is a 9GB server log where i want to end up with two new files.
%Results_COUNT% is the first file with a count of each log using the class file name
Code: Select all
85 com.platform.mdm.core.identity.impl.EnterpriseIdentitySyncService
1 com.platform.mdm.tcp.client.InProcessMethodInvocationInitiatedTcpTunnelInstanceHandler
2058567 com.platform.mdm.tcp.messaging.WorkflowBasedIncomingMessageRouterFactory
630 com.platform.transaction.TransactionImpl
630 com.platform.workflow.io.AbstractLinkOutputSource
Batch file
Code: Select all
echo ********************************************************************************
echo ********************* Creating count summary of loglines *********************
echo ********************************************************************************
echo.
echo Get a count of each log line and add results to file
echo.
cut -f6 -d"-" %File_IN% | sort | uniq -c > %Results_COUNT%
Echo Done!
echo.
echo ********************************************************************************
echo ********************* Creating separate file with raw loglines *********************
echo ********************************************************************************
echo.
echo Scans Count file for logs above set value (default is 10000) and output the complete line to its own file
echo.
for /f "tokens=1 " %%d in ('cat %Results_COUNT% ^| awk "$1>10000" ^| sed -e "s/^[ \t]*//" ^| awk -F "( )" "{print $3}"') do (grep %%d %Results_ALL_New% > %%d.log)
Echo Done!
echo.