Programming :: Save The Results Of A Fortran Loop In A Text File?

Nov 2, 2010

I am trying to store the results of my code to a separate text file.But the problem is, as my results comes from a loop, my text file shows only the last result, not all of them.Like if the loop runs 5 time the text file shows the result for the 5th step.But i need to store all of them (1 to 5).Can I use awk to print the output field and store to another file and creat a new line so that the next output field goes to a new line?(just an idea, dont know).

for (( i=1; i<=5; i++))
./file.exe > output.txt

View 2 Replies


Programming :: Fortran How To Open A File In Loop

Jun 29, 2011

I have a 50 file name NSSAVE0001.vtk to NSSAVE0050.vtk.Do I have to manually type individually command to open each file or can I have a loop to open file?

View 3 Replies View Related

Programming :: Generating Files With Different Names At Each Loop In Fortran?

Nov 7, 2010

I am trying to write a loop to open four main-data-files. At each open of the main-data-file, I want the loop to open another four sub-files and split the data from the mail-data-file according to the creteria and dump into the four files. When the loop goes to the second main-data-file, it shall generate another 4 sub-files with different file name. And the process goes on. That means I will have total of 16 sub files for the four main-data-files. Each four files from the 16 files shall have specific name on it. Based on the code which I given below, I would say when the file at UNIT=100 is opened, 4 new files needed to be opened as well. They are:


View 1 Replies View Related

Programming :: Store Data In Text File And Be Able To Modify It And Save As Well Using C++?

Jan 25, 2010

I wanna learn how to store data in text file and be able to modify it and save as well using C++.

Note: im using Turbo C++ 3.0

View 9 Replies View Related

General :: Print Some Results In Text File Using Script

Feb 27, 2011

I am writing a script which would just print following kind of result into a text file (result.txt)

XYZ test Results
ID: <unique-id> Date: <date>
| Task | Result | Time |
| <task1> | <Result1> | <time1> |
| | | |
AD No: <adn> Generated Date: <tdate>

Above all the values of <something> are dynamic or predefined.

View 3 Replies View Related

Fedora :: Fortran Program Gives Different Results Between F15 I686 And X86_64

Sep 2, 2011

I am having a problem with a simple program I wrote in Fortran (gfortran). This program basically reads a long list of numbers and makes some operations with them. Double precision is used in the variables and functions, and AFAIK everything is in order with the program. The thing is that I accidentally noticed that said program yields different results, and I am talking about integers being different, something noticeable. Apparently the offending chunk of code might be:




One of the involved machines has F15 x86_64 and the other one F15 i686. My first guess is that this has something to do with how Fortran handles precision (which I supposed was the same for 32 and 64 bits). To compile the program I use:


gfortran --free-form -fno-whole-file program.f90

Is there another option I should pass the compiler to make sure the same precision is used in both cases? Or what can I do here?

View 3 Replies View Related

General :: Output To A Text File, The Results Of Compound Command?

Jul 28, 2010

How to output to a text file the compound command:

find -type f -print0 | xargs -0 grep -l "desired text"
I have not been able to find the answer.


View 5 Replies View Related

Programming :: 3D Array In MAT File ->DAT File To Read In FORTRAN?

Jul 2, 2009

Alright, so I have been trying to resolve this issue for awhile, but now feel like help is very necessary.I have a 128(by)128(by)128 array in a MAT file, and am using the following MATLAB script to convert it to a DAT file:

load C_42.mat


View 2 Replies View Related

General :: How To Loop A Script Execution With Param From A Text File

Aug 14, 2010

I need to run ./pythonScript keyword one time for each keyword in a text file, how can I do this from a gnome terminal? (without having to modify the pythonScript)

pseudo code:

for each keyword in file:
./pythonScript keyword
waitfor(pythonScript to finish)

View 3 Replies View Related

Programming :: How To Save Text Data In Binary Format Using C

Feb 20, 2010

I have created a file using open() and written data to it. Data appears as normal characters in the file. How to save these characters in a binary format in that file using C language? Here I mean that the characters should be actually stored as 0 and 1. Do I have to convert the whole data using some function or there is some standard way to do it in Linux?

View 14 Replies View Related

Fedora :: Scan And Save As A Text File?

Apr 26, 2010

Fedora12/Kde4After a Sane Scan how do I Save a scan as a *.txt file ? gocr does not work, I can save in any other format but a txt file.

View 6 Replies View Related

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.


Then i have another text file called file2.txt contains


Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

Ubuntu :: Copy Folder Location And Save In Text File?

May 17, 2010

I want to copy location of every .avi , .jpg file present in a folder or in subfolder present in a direcotry and save in a textfile how to doex : /home/username/Desktop/bookofeli/video/book.aviit should give full locaiton of path how to do

View 2 Replies View Related

General :: Commands To Save Md5sum Of Files In A Folder Into A Text File?

Sep 14, 2010

I've found these commands in [URL]:


find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/ | sudo tee md5sum.txt

But I don't understand these commands, even after reading their manuals.

View 4 Replies View Related

General :: Command For Appending A Text At The Start Of Every Line And Save It Another File?

Mar 10, 2011

I wish to append a text at the start of every line and save it to another file without changing the original file.know the command

For example:


View 5 Replies View Related

Programming :: Loop Through Records In A File?

Apr 23, 2011

I want to loop through the records in the below file (homedir.temp)

I want to do the following activities with each record1. du -s - to get the total usage for that directory (my variable name is SIZE)2. divide SIZE by du -c for /home to get the percentage of usage. (my variable name is PER)3. write the directory, SIZE, PER to a filePROBLEMI am using the below for loop: for record in homedir.tempthe mentioned activitiesdonehe above is not looping through the records. It does the first record perfectly and exits the loop.

View 14 Replies View Related

Programming :: Read A File With A While Loop?

Apr 25, 2010

ITT and am just lurning about scripting and need to read a file and output the file to the screen. We need to do this with a while loop.

View 5 Replies View Related

General :: Loop Append Text To Text Files?

Jan 15, 2010

may be an advanced question but I need to know how to do this. Here at work I am in charge of recruiting and we have about 1,000 resumes in already. All of the resumes are in a .pdf format. I need to rename every .pdf in the following format:{firstnameLastname}.pdfThe only way I know how to do this is to convert all the .pdf files to text, extract the name out of the first few lines of text, import into excel, and then use VBA to rename the files in mass:Here is my logic so far:~Deskop/a = houses all the .pdfresumesOpen terminal: Code: cd ~/Desktop/afor f in *.pdf; do pdftotext -raw $f; done That will convert all of the preceding resumes into text filesNow I would like to append the name of the text file into the last line of the text file. So, for example, for Resume1.txt, I want to append "Resume1.txt" to the last line within Resume1.txt. So after I run the command I open Resume1.txt and on the last line within I want to see "Resume1.txt" on the last line, at the end of the resume.How can I do this? I would like to use a loop and have the terminal append the filename to the body of the text file until all of the have been appended.

View 1 Replies View Related

Fedora X86/64bit :: Same Fortran Code, Different Results For 32 And 64bit System?

Jan 15, 2010

I have the simple fortran codes as:

integer :: i1=2455121, i2=2455121
real :: s1=0.19123840, s2=0.20749992
real*8 :: a1, a2
a1=i1+s1; a2=i2+s2


When s1 and s2 are stated with 'real*8', the 64bit and 32bit systems get the same results.

View 6 Replies View Related

Programming :: Adding Lines Of Text To Beginning Of Text File

Jan 19, 2009

I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.

View 2 Replies View Related

Programming :: Delete Line Of Text From Text File Via Shell?

Jan 13, 2010

I have to delete a certain line of text from the a textfile via ubuntu's shell scripting.I have done research, and it seems that most people advocate the usage of sed /d option. sed makes does not edit the text file. Hence, most options I discovered involved the use of a temporary variable/textfile and then overwriting the old file with the temporary new file. Is there anyway whereby I can bypass the use of temporary storage containers? I hope there is any magical combination of commands to edit the file directly.

View 3 Replies View Related

Programming :: Exporting Glade Text View To Text File?

Jan 8, 2011

I want to display something in my text view widget in glade using c code. that's all right.
now I need to attach a save button beneath the text that on click the text view content should save as a txt file..

View 8 Replies View Related

Programming :: Formatting Fields And Text Being Displayed From Text File?

Feb 9, 2011

I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:



User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!


So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.

The desired output should look like this:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!


Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.

View 15 Replies View Related

Programming :: Take A List From A File And Use It In A For Loop In Python?

May 11, 2009

so far I have this

list = open('list.txt')
for x in list:

View 3 Replies View Related

Programming :: Loop To Process Entries In A File?

Jul 9, 2010

I hade created a file with following text entries.

content of fileitems.txt

How do I read the file one line at a time and so its ready to do something with that line.

View 3 Replies View Related

Programming :: Add Text Before Line Number In Text File?

May 3, 2010

a sed command to add a text before line number in text file? I have text file with 500 lines, and i want to add 3 more lines with text after line 300, OR before line 302, isn't no problem.

View 16 Replies View Related

Programming :: Sed - Save Output To File With Filename From Content Of Another File?

Feb 28, 2011

My employer issues pdf files with everyones work schedules. I copy the content and save it as plain text in a file called unformatted (hope to be able to automate this step someday). Im working on a SED script that reduces unformatted to only display what I want to see and saves the result in a file Ive named formatted. After that I have to manually copy formatted and save it with that days date as a filename e.g. 2011-02-25 or whatever day is scheduled in the pdf, for use on a mobile device (Nokia N900). I noticed that the date occurs on certain lines in the file so I added a line like:

sed -n 's/^Date: (201[1-9])/([0-1][0-9])/([0-3][0-9]).*/1-2-3/p' < unformatted >theDate
That creates a file theDate with the date in it that I wish to use as the filename for this particular instance. So I would like to skip the file formatted all together and have the sed- script write to a new file using the content of the Date as a filename, but how do I make that happen? And of course it would be more elegant if I could skip the intermediate theDate file as well.

View 4 Replies View Related

General :: For Loop Or While Loop To Read The Fields Of A File?

Sep 1, 2010

I have a mytext file with month and year as two separate fields. likemytext fil

08 2010
09 2010
10 2010

I want to read the values of each field i.e., month and year into an awk script.

View 10 Replies View Related

General :: Unix - Cat Command To Save Results Of Other Commands

Nov 26, 2010

This question may be silly and super easy for linux connaisseurs, but I was just wondering, for instance, I want to use the >find command to search for a file and send the results to a text file

View 5 Replies View Related

Programming :: Save File From Deletion In C Code?

Apr 26, 2011

I create the file mytest.txt. Since this process is using this file. if I run this code in background and simply run "rm -rf mytest.txt" than file gets delete.Please help me how to save this file from other process.Here is my code

int main()
FILE *fp;


View 9 Replies View Related

Copyrights 2005-15, All rights reserved