Reading a log file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading a log file
# 15  
Old 08-20-2015
Hm.

Try replacing that statement with

Code:
printf("%s\t%s\t%s\t", T[1], substr(T[n],1,1)=="t"?"triplet":"singlet", T[2]=="CC"?"CC":"DFT");

This User Gave Thanks to Corona688 For This Post:
# 16  
Old 08-24-2015
Code:
awk '
BEGIN           {print "Compound\tState\tMethod\tEnergy"}
FNR==1          {n=split(FILENAME, T, "-")
                 printf "%s\t%s\t%s\t", T[1], substr(T[n],1,1)=="t"?"triplet":"singlet", T[2]=="CC"?"CC":"DFT"
                 FOUND=0
                }
/HURRAY/        {FOUND=1
                }
FOUND &&
/^FINAL.*ERGY/  {print $NF
                }
' *.out

one last question,

how can I ask the the script to print not converged or error
if the last condition was not met
Code:
FOUND &&
/^FINAL.*ERGY/  {print $NF
                }

# 17  
Old 08-24-2015
Try to add
Code:
FOUND &&
/^FINAL.*ERGY/  {print $NF
                 CONV=1
                }
END             {if (!CONV) print "not converged or error"
                }

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

3. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

4. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

5. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

6. Shell Programming and Scripting

Menu / Log files - reading / display

So I'm pretty green still at this, and right now I don't even have the IF statements in just trying to get this part to work. I want to basically click optino 1,2,3,4 for which logs I want to search, and then be able to put in the variable I want to grep out? Sounds easy just not clear in my mind... (4 Replies)
Discussion started by: xgringo
4 Replies

7. Shell Programming and Scripting

Reading/Compressing of log file

Hello All Posted a similar thread in some other section too. Regrets if this section is not suitable for this post. Request all the members to be tolerant as i'm a newbie here :) Coming to the topic : I've this huge log files of size 20GB-30 GB in my unix server. I want to analyse the log... (2 Replies)
Discussion started by: sgbhat
2 Replies

8. UNIX for Dummies Questions & Answers

Log File Writing and Reading

Hi all, I have the following shell script code which tries to sftp and writes the log into the log file. TestConnection () { echo 'Connection to ' $DESTUSERNAME@$DESTHOSTNAME $SETDEBUG if ]; then rm $SCRIPT ; fi touch $SCRIPT echo "cd" $REMOTEDIR >> $SCRIPT echo "quit" >>... (10 Replies)
Discussion started by: valluvan
10 Replies

9. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question