Billu_m
asked on
Extract string from a file using PERL
HI experts,
I have a content of a logfile as follows (below), I need to open a file and search for a string (using PERL)"Installation operation completed successfully"
string from this if this string is found i need to retrn 1 from the perl function.
can somebody help me in how can i approach this , can anybody send me the pseudo or link to the similar script.
=== Logging stopped: 4/20/2009 23:02:18 ========================== ========== ===
MSI (s) (18:78): Note: 1: 1707
MSI (s) (18:78): Product: XI R2 Service Pack 6 -- Installation operation completed successfully.
MSI (s) (18:78): Cleaning up uninstalled install packages, if any exist
MSI (s) (18:78): MainEngineThread is returning 0
MSI (s) (18:30): Destroying RemoteAPI object.
MSI (s) (18:08): Custom Action Manager thread ending.
MSI (c) (30:D0): Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (30:D0): MainEngineThread is returning 0
=== Verbose logging stopped: 4/20/2009 23:02:18 ========================== ======
I have a content of a logfile as follows (below), I need to open a file and search for a string (using PERL)"Installation operation completed successfully"
string from this if this string is found i need to retrn 1 from the perl function.
can somebody help me in how can i approach this , can anybody send me the pseudo or link to the similar script.
=== Logging stopped: 4/20/2009 23:02:18 ==========================
MSI (s) (18:78): Note: 1: 1707
MSI (s) (18:78): Product: XI R2 Service Pack 6 -- Installation operation completed successfully.
MSI (s) (18:78): Cleaning up uninstalled install packages, if any exist
MSI (s) (18:78): MainEngineThread is returning 0
MSI (s) (18:30): Destroying RemoteAPI object.
MSI (s) (18:08): Custom Action Manager thread ending.
MSI (c) (30:D0): Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (30:D0): MainEngineThread is returning 0
=== Verbose logging stopped: 4/20/2009 23:02:18 ==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HI oleber,
the code snippet works fine for "ANSI Text documnet " , but not for " Unicode text document "
please let me know how to make it work for "Unicode text document "
Thanks
Billu_m
the code snippet works fine for "ANSI Text documnet " , but not for " Unicode text document "
please let me know how to make it work for "Unicode text document "
Thanks
Billu_m
local @ARGV=("file");
/installation operation completed successfully/ and return 1 while <>;
}