I was wondering if it possible to write a bash script that would do the following:
I perform molecular modelling calculations and the output files are all text files with various different extensions.
For example, I submit the input file "job_name.inp" and when it is done or the 2 day time is reached, I get an output file "job_name.inp". A typical input file looks something like this:
If the job does not finish in the allotted 2 days, then another file is created "job_name.rst", which contains data that is required to restart the calculation.
If I want to restart the calculation from where it was killed by the job-scheduler, then I need to make a new input file, let's call it "job_name_restart.inp". At the very end of the text within this new input file "job_name_restart.inp" I have to paste in text that is contained in "job_name.rst".
A shortened version of the "job_name.rst" file looks like this:
The text eventually ends with one blank line. What I need is the $VIB heading and all of the text after $VIB to be appended to the end of file "job_name_restart.inp" and then to have "$END" inserted at the very end of the file.
I should also mention that the "job_name.rst" file is always placed in the directory /scratch/mzd/gamess-scratch/.
The input file is always in a separate directory with a different descriptive name of the job I am running. In this example, it would be /scratch/mzd/job_name/.
Sorry, I didn't notice space in front of "$VIB". Try now:
This should print on your terminal lines that should go to job_name_restart.inp. If they are correct, then redirect that command's output using ">>":
Hey there. Thanks so much for replying so quickly. But I get the same thing, although it seemed to pause for a second before it showed the "$END" in the terminal window.
---------- Post updated at 04:02 PM ---------- Previous update was at 03:58 PM ----------
OK. I entered in the second command that you suggested, and all it did was add "$END" to the file. The text from the file "job_name.rst" was not appended.
Are you sure there is line containing "$VIB" in file job_name.rst? And did you copy that code correctly? There is no point in running second line of code, if first one doesn't provide desired output.
I just checked two or three different .rst files and there is always a line containing "$VIB".
It is always on the 3rd line of the file, and it is always preceded by 1 space. It is followed by three spaces and then a new line starts. I don't know if this helps but I will represent spaces with underscores: This is how the 3rd line of the the job_name.rst file:
"_$VIB___"
If it helps, "$VIB" starts on column 2 and the cursor moves to the next line when it reaches column 9 i.e. there is no column 10 on that line.
Hi All-I am new to Unix , I need to write a script. Can someone help me with a requirement where I have list of files in a directory, I want to Merge the files if a pattern of string matches in filenames?
AAAL_555A_ORANGE1_F190404.TXT
AAAL_555A_ORANGE2_F190404.TXT
AAAL_555A_ORANGE3_F190404.TXT... (6 Replies)
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Hi all,
i have a generated report in unix in the following command like
input.txt
47.85,10
0124,42.35,8
0125,3.5,2
the input file format is fixed
I need the my output file with append text as below
output.txt
0124 amount:42.35
0125 amount:3.5
0124 count : 8
0125... (34 Replies)
Hi,
I had generated a report in my tool as followsoutput.txt
43.35
9
i needed the script to generate a new file like below
i want to append the text to each of these lines of my filenewoutputfile.txt should be
Total Amount : 43.35
Record Count:9
Regards,
Vasa Saikumar.
... (2 Replies)
i have to append a text file
grep for a word, if found, put comment in starting of the line.
here is an example
cat test.sh
bin/ksh
Hello World
Test Message
:wq!
search for "bin" word in test.sh file if found comment it out at starting of the line:
Output as follows:
#bin/ksh... (5 Replies)
Hi i have a file like this
mailboxnum 20
filename <to subsitute>
fileloaction /home/dd234/
filetype txt
in a directory i have set of files for ex:
TT45.1.2
TT45.1.3
TT45.1.4
.
.
in for loop i have to take this files and subsitute one by one
ex: (1 Reply)
Hi
Below command is returning the list of files which having this string "MTL_SYSTEM_ITEMS".
find . -name "*"|xargs grep -il MTL_SYSTEM_ITEMS
Ex: Above command is returing 2 files (Out of 10 files 2 files having this string). ./file1.txt and ./file2.txt
Here I want to append... (3 Replies)
Say I have a text file like:
1
3
4
How would I use ksh to put the number '2' into the second line of that file? I'm using OpenBSD so the sed syntax might be a bit different (I have no idea how to use sed, though) (4 Replies)
i have something like below in my SAS code and every month i need to append a text say 'ext.hlc_sum0906' near ext.hlc_sum0905 and next month after ext.hlc_sum0906 i need to append this 'ext.hlc_sum0907' and so on like that.. is it possible using SED or some other command in unix?
%let... (1 Reply)
I have a command stream that will parse down an ftp DIR listing of a remote directory and return the name of the newest file that I am interested in. The command is
sed -e '/^d/d' sppay.listing |sed -n -e '/SPPAY/p'|sort -r -k 43M,45 -k 47,48 -k 50,54|sed -n -e '1p'|cut -c 56-99
and what it... (2 Replies)