• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Parse log file for a specific word and print the line where the word is found

I need to parse a log file for a particular line containing a specific text. The log file contents is pasted below. From here, I need to find a line with text "Restored file" in it and put all of them to a new output file.

1191927130      # Restored file "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Noriko Uchino (Rieger) Resume.doc" (F8444-G1-V1:V1=>C53788-S3-F8444-V1:V1).
1191927131      @ RestoreThread: Restore job #11, source "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls", generation 0, destination "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls".
1191927131      # Restored file "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls" (F20300-G3-V3:V3=>C53788-S1027-F20300-V3:V3).
1191927134      @ RestoreThread: Restore job #12, source "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\2007-Eric2.xls", generation 0, destination "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\2007-Eric2.xls".
1191927135      # Restored file "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\2007-Eric2.xls" (F20308-G2-V2:V2=>C53788-S1027-F20308-V2:V2).
1191927141      @ NetComSession: Logout from server web8.site1.Tester.com, computer number 53788, operation restore, status "Restore Completed", result Success.
1191927141        Restore completed: time 0:12, downloaded 3 files, file size 75K, and transmit size 16K (average speed 10 Kbps).
1191927143      @ NetComConnection: Connecting to web8.site1.Tester.com, timeout 60, left = 60.
1191927144      @ NetComConnection: Connected to server web8.site1.Tester.com (IP address 38.97.103.145) for computer number 53788.
1191927144      @ NetComConnection: Connects = 19, ConnectFails = 0, ConnectFailGetHostByName = 0, ConnectFailNotAvailable = 0, ConnectRAS = 0.
1191927145      @ NetComSession: Login successful server web8.site1.Tester.com, computer number 53788, operation restore, session 4429, login time "Wed, 10 Oct 2007 10:52:20 GMT" (245328740).
1191927145      # Established connection to restore server.
1191927145      @ RestoreThread: Restore job #13, source "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls", generation 0, destination "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls".
1191927145      # File not overwritten: "C:\Documents and Settings\Eric Rieger\My Documents\Work Folder\Eric's Personal\Income from Start 2007.xls".
1191927152      @ NetComSession: Logout from server web8.site1.Tester.com, computer number 53788, operation restore, status "Restore Completed", result Success.
1191927152        Restore completed: time 0:07, downloaded 0 files, file size 0, and transmit size 0 (average speed 0 Kbps).
1191927268      = 19:54:28
1191927268      @ NetComConnection: Connecting to web8.site1.Tester.com, timeout 60, left = 60.
1191927290      @ NetComConnection: Connected to server web8.site1.Tester.com (IP address 38.97.103.145) for computer number 53788.
1191927290      @ NetComConnection: Connects = 20, ConnectFails = 0, ConnectFailGetHostByName = 0, ConnectFailNotAvailable = 0, ConnectRAS = 0.
1191927313      @ NetComSession: Login successful server web8.site1.Tester.com, computer number 53788, operation restore, session 4430, login time "Wed, 10 Oct 2007 10:54:46 GMT" (245328886).
1191927314      # Established connection to restore server.
1191927314      @ RestoreThread: Restore job #14, source "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html", generation 0, destination "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html".
1191927315      # Restored file "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html" (F32252-G1-V1:V1=>C53788-S3093-F32252-V1:V1).
1191927315      @ RestoreThread: Restore job #15, source "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html", generation 0, destination "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html".
1191927315      # File not overwritten: "C:\Documents and Settings\Eric Rieger\Application Data\TesterAlert.html".
1191927315      @ RestoreThread: Restore job #16, source "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\Outlook.NK2", generation 0, destination "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\Outlook.NK2".
1191927321      # Restored file "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\Outlook.NK2" (F1986-G95-V95:V95=>C53788-S4359-F1986-V95:V95).
1191927321      @ RestoreThread: Restore job #17, source "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\outcmd.dat", generation 0, destination "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\outcmd.dat".
1191927322      # Restored file "C:\Documents and Settings\Eric Rieger\Application Data\Microsoft\Outlook\outcmd.dat" (F1985-G4-V4:V4=>C53788-S1099-F1985-V4:V4).


0
desiaashik
Asked:
desiaashik
1 Solution
 
ghostdog74Commented:
at the minimum

grep -i "Restored file" logfile > newfile
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now