Filter search result to another file from Big Syslog File

Search “10.10.10.100” inside syslog.txt file and then

•Redirect all the result to matches.csv file located under :\Users\demo\Downloads\ via VIM or VB Script
•Save into an Excel tab

Example with VIM in Both Linux and Windows:

1.Open syslog.txt with vim.
2.Run following command

:redir > c:\Users\demo\Downloads\matches.csv|execute ‘g/10.10.10.100/#’|redir END

Example with excel and VB Script:

1.Open Excel
2.Developer Tab
3.Visual Basic
4.Insert module
5.Paste in the code below

Sub foo()
Open “c:\users\demo\syslog.txt” For Input As 1
Open “C:\users\demo\matches.csv” For Output As 2
Do While Not EOF(1)
Line Input #1, a$
If InStr(a$, “10.10.10.100”) > 0 Then
Print #2, a$
End If
Loop
End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s