LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2011, 04:16 AM   #1
genROCK
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Rep: Reputation: Disabled
Smile How to find the words in log files


Hi everyone! can you help me to find the words in the input and separate all file to processed folder and failed folder.. thanks.. this is what all I need to finish the project..

input:
2011-10-07 14:31:39.715 [048] Info Asap Alarm AsalaAlarmApiImplementor::SendConditional
2011-10-07 14:31:39.716 [048] Info DpOamAlarm Sending conditional alarm: type 9016, "Import failed" and got alarm instance id 428983
2011-10-07 14:31:39.716 [048] Info Alarm Sending conditional alarm type = 9016, alarm instance id = 428983
2011-10-07 14:31:39.717 [048] Info SimImport Parse and import file GLO06095.cps
2011-10-07 14:31:39.717 [048] Error SimImport 3842: SIERRORCODE:1006 Error while parsing file header
2011-10-07 14:31:39.717 [048] Error SimImport 3842: GLO06095.cps(0) : error - file not found
2011-10-07 14:31:39.717 [048] Info SimImport *** Processing of file GLO06095.cps failed ***
2011-10-07 14:31:39.717 [048] Info SimImport
2011-10-07 14:31:39.718 [048] Info Asap Alarm AsalaAlarmApiImplementor::SendConditional
2011-10-07 14:31:39.719 [048] Info DpOamAlarm Sending conditional alarm: type 9016, "Import failed" and got alarm instance id 428983
2011-10-07 14:31:39.719 [048] Info Alarm Sending conditional alarm type = 9016, alarm instance id = 428983
2011-10-07 14:31:39.719 [048] Info SimImport No more files in input directory : /var/opt/smarttrust/dpmaster/data/sim_import/input/
2011-10-07 14:31:39.719 [048] Info SimImport Time between imports : 300
2011-10-07 14:31:39.719 [048] Info SimImport Next check is 5 minutes 0 seconds away
2011-10-07 14:36:39.726 [048] Info SimImport 2 number of files to process
2011-10-07 14:36:39.726 [048] Info Database Storage KEK maps are cleared
2011-10-07 14:36:39.727 [048] Info SimImport Parse and import file GLO06096.cps
2011-10-07 15:31:18.886 [048] Info SimImport
2011-10-07 15:31:18.886 [048] Info SimImport *** File GLO06096.cps processed (0h 54min 39sec) ***
2011-10-07 15:31:18.886 [048] Info SimImport
2011-10-07 15:31:18.887 [048] Info SimImport Parse and import file GLO06097.cps
2011-10-07 16:20:28.017 [048] Info SimImport
2011-10-07 16:20:28.018 [048] Info SimImport *** File GLO06097.cps processed (0h 49min 9sec) ***


output:

failed file in a failed folder:


Error SimImport 3842: SIERRORCODE:1006 Error while parsing file header
Error SimImport 3842: GLO06095.cps(0) : error - file not found
GLO06095.cps


processed file in the processed folder:

GLO06096.cps
GLO06097.cps


Thank you very much! Your answers are much appreciated.
 
Old 10-19-2011, 04:26 AM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: AntiX
Posts: 1,950

Rep: Reputation: Disabled
How about :-

cat input.file | grep "Error" > failed.file
cat input.file | grep "processed" > processed.file
 
Old 10-19-2011, 06:03 AM   #3
genROCK
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
thanks sir..

but how about to only get the
Error SimImport 3842: SIERRORCODE:1006 Error while parsing file header
Error SimImport 3842: GLO06095.cps(0) : error - file not found
GLO06095.cps

when i try the command, it gets the
2011-10-07 14:31:39.717 [048] Error SimImport 3842: SIERRORCODE:1006 Error while parsing file header
2011-10-07 14:31:39.717 [048] Error SimImport 3842: GLO06095.cps(0) : error - file not found
2011-10-07 14:31:39.717 [048] Info SimImport *** Processing of file GLO06095.cps failed ***

thanks fatmac for your answer.
 
Old 10-19-2011, 07:24 AM   #4
parunachalam
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
Thumbs up

Try

grep 'Error SimImport' input.file> failed.file
grep 'processed' input.file > processed.file
 
Old 10-19-2011, 07:37 AM   #5
genROCK
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks..

the failed file is blank.. thanks..
 
Old 10-19-2011, 07:40 AM   #6
MANOHARNLINUX
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Rep: Reputation: Disabled
grep 'pattern' infile > outfile
Make sure that in the pattern you take care of number of spaces between workds should match with the entry in log file.
 
Old 10-19-2011, 09:21 AM   #7
genROCK
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
thanks..

i dont get what you want to say on the command..
 
Old 10-19-2011, 09:29 AM   #8
genROCK
LQ Newbie
 
Registered: Sep 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
can you get :

Error SimImport 3842: SIERRORCODE:1006 Error while parsing file header
Error SimImport 3842: GLO06095.cps(0) : error - file not found
GLO06095.cps

only in command or in script??

How to get them, and not:
2011-10-07 14:31:39.717 [048]

Thanks..
 
Old 10-19-2011, 09:31 AM   #9
bhargava.konduru
LQ Newbie
 
Registered: Jul 2011
Posts: 11

Rep: Reputation: Disabled
Regarding Compilation problem in Visual Studio 2008

Hi,

Is there a way to abort compilation in the visualstudio 2008 environment?

I modified a header file(added a syntax error ) and started compilation in the visual studio environment.

There are errors as I compile but I don't know how to stop the compilation. is there a way to abort it?

I have to wait for the vs to finish compilation of all the affected files.

Thank you for your time.
 
Old 10-19-2011, 10:18 AM   #10
phaemon
Member
 
Registered: Jul 2011
Posts: 40

Rep: Reputation: 5
These commands should work for the input as given. Assuming the input is in "inputfile.txt":
Code:
grep "Error" inputfile.txt > failed.file
grep "Processing of file" inputfile.txt | cut -d " " -f 10 >> failed.file

grep "processed" inputfile.txt | cut -d " " -f 8 > processed.file
The grep should be obvious, the "cut" command cuts out a particular part of a line. The second one, for example, says "Use a space as the delimiter and take only the 8th field".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert screen.log and putty.log files into linux readable files aksharb Linux - Software 1 03-20-2011 08:16 AM
SuSE 9.3 - System went down; what log files should I be looking for to find out why? EnderX Linux - Newbie 2 07-31-2009 10:39 AM
Find several different words and replace with one using sed. Techno Guy Linux - Newbie 18 07-06-2009 08:16 AM
find a key words in a file ashley75 Linux - General 3 08-29-2007 05:30 PM
Can log files be time stamped? (such as FTP login and transfer log files) bripage Linux - Networking 6 08-08-2002 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration