Sponsored Content
Top Forums Shell Programming and Scripting Hundreds of files need manual preparation. Does shell script could do it automatically? Post 302945677 by RudiC on Monday 1st of June 2015 01:23:05 PM
Old 06-01-2015
This is as far as I get on first attempt; use it as a template to be enhanced. For the correct order of lines of information, it might be worthwhile to create a template form to be read and then filled in from the log files.
Code:
awk '
FNR==1                  {gsub (/^.*\/|\..*$/, "", FILENAME)
                         print FILENAME 
                        }
/SCF Done:/             {print "Electronic Energy"
                         print $5
                        }
/Molecular mass/        {print "Molecular Weight (amu)"
                         print $(NF-1)
                        }
/Temperature/           {print "Values (If \"Interval\", give start and finish temp.)"
                         print $3
                        }
/Pressure/              {print "Pressure (in atm or bar - if given in atm, enter as a negative number. -1 is the G09 default)"
                         print ($NF=="Atm."?"-":"") $(NF-1)
                        }
/Multiplicity/          {print "Electronic degeneracy (multiplicity)"
                         print $NF "."
                        }
/Rotational.*ber/       {print "Rotational factor (symmetry factor)"
                         print $NF
                        }
/Frequencies/           {FC++;for (i=3; i<=5; i++) FR[FC,i]=$i}   
/Eigenvalues -- /       {gsub (/\.[0-9][0-9][0-9][0-9][0-9]/,"& ")
                         printf "Moments of Inertia (in amu x au2; none for Atom, 1 for Linear, 3 for General)\n%s\n%s\n%s\n",
                                $3, $4, $5
                        }
END                     {print "Vibrational Frequencies (first line: number; then freqs. in cm-1)"
                         print 3 * FC
                         for (i=3; i<=5; i++) for (j=1; j<=FC; j++) print FR[j,i]
                        }    
' /tmp/feco4_s.log.txt

resulting in
Code:
feco4_s
Electronic degeneracy (multiplicity)
1.
Electronic Energy
-1715.82310939
Electronic degeneracy (multiplicity)
1.
Electronic Energy
-1715.82310939
Values (If "Interval", give start and finish temp.)
Kelvin.
Pressure (in atm or bar - if given in atm, enter as a negative number. -1 is the G09 default)
-1.00000
Molecular Weight (amu)
167.91460
Moments of Inertia (in amu x au2; none for Atom, 1 for Linear, 3 for General)
1284.73849
1536.05333
2170.19761
Rotational factor (symmetry factor)
2.
Vibrational Frequencies (first line: number; then freqs. in cm-1)
21
45.7886
96.4952
353.2741
427.8395
499.7992
640.4272
2062.0748
66.7894
96.9991
363.5129
430.9072
537.9941
640.7995
2062.6585
79.7836
335.4020
422.7705
448.4787
595.3209
2042.2981
2151.4066

This User Gave Thanks to RudiC For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to automatically check ports in shell?

Good day, I'm new to linux environment...Is there any scripts available for me to check ports (lets say port 80 and 21) through shell with just a single commandline? Any response is very much appreciated.. thanks (4 Replies)
Discussion started by: arsonist
4 Replies

2. Shell Programming and Scripting

how to run shell script automatically

hi , i m trying to run bash scrip automaticially but i dont know how i can do this an anybody tell me how i can autorun shell script when i logon . thanks (9 Replies)
Discussion started by: tahir23
9 Replies

3. Shell Programming and Scripting

Shell script to invoke options automatically

i have a script which has 2 options. a b And a has 6 sub options. i want to write a script which will call the parent script and give options automatically. examle: linasplg11:/opt/ss/kk/01.00/bin # startup.sh /opt/ss/rdm/01.00 Please select the component to... (2 Replies)
Discussion started by: Aditya.Gurgaon
2 Replies

4. Shell Programming and Scripting

automatically format Shell Script (bash)

Hi In TOAD I can write SQL code, then select the SQL code -> Menu Edit -> Format Code The output is well formatted code (correct indent, ...) Is there a tool (for Windows and/or UNIX) what can do the same for bash code? TOAD (software) - Wikipedia, the free encyclopedia (1 Reply)
Discussion started by: slashdotweenie
1 Replies

5. Shell Programming and Scripting

Shell script to automatically download files

I am new to shell scripting and need to write a program to copy files that are posted as links on a specific url. I want all the links copied with the same file name and the one posted on the webpage containing the url onto a specific directory. That is the first part. The second part of the script... (2 Replies)
Discussion started by: libertyforall
2 Replies

6. Solaris

Renaming hundreds of files at the same time

Hi, I am having issues trying to figure out how to rename files like this: TEST1_B.tt To SQP_CAN_B.tt I have hundreds of files like those, I need to rename them automatically. Any help will be greatly appreciated. Thanks, (5 Replies)
Discussion started by: ocramas
5 Replies

7. Shell Programming and Scripting

Best way to connect to hundreds of nodes and grep log files

Hi, What will be the best way to connect (ssh) to hundreds of nodes and grep log files parallely from shell. Using for loop seems to be sequential. Are there any shell built in construct which could be used to achieve this? Is the sub shell any good here? (1 Reply)
Discussion started by: agent001
1 Replies

8. Shell Programming and Scripting

Need to add code to hundreds of .html files

Need assistance to add code to hundreds of .html Code will look like below and needs to be added below <html> tag: <script> Some .js code here </script> This will be used in Fedora release 7 (Moonshine). I will appreciate any type of help and/or orientation. Thank you! (4 Replies)
Discussion started by: Ferocci
4 Replies
PRINT(3)								 1								  PRINT(3)

print - Output a string

SYNOPSIS
int print (string $arg) DESCRIPTION
Outputs $arg. print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list. PARAMETERS
o $arg - The input data. RETURN VALUES
Returns 1, always. EXAMPLES
Example #1 print examples <?php print("Hello World"); print "print() also works without parentheses."; print "This spans multiple lines. The newlines will be output as well"; print "This spans multiple lines. The newlines will be output as well."; print "escaping characters is done "Like this"."; // You can use variables inside a print statement $foo = "foobar"; $bar = "barbaz"; print "foo is $foo"; // foo is foobar // You can also use arrays $bar = array("value" => "foo"); print "this is {$bar['value']} !"; // this is foo ! // Using single quotes will print the variable name, not the value print 'foo is $foo'; // foo is $foo // If you are not using any other characters, you can just print variables print $foo; // foobar print <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon no extra whitespace! END; ?> NOTES
Note Because this is a language construct and not a function, it cannot be called using variable functions. SEE ALSO
echo(3), printf(3), flush(3), Heredoc syntax. PHP Documentation Group PRINT(3)
All times are GMT -4. The time now is 12:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy