LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Closed Thread
 
Search this Thread
Old 06-23-2011, 05:55 AM   #1
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Rep: Reputation: Disabled
Fortran. How to automatically find the starting and ending line of desired variable


I am loading the file in Fortran.
File looks something like this (shown below)
I am interested in Velocity values and not Pressure values.

Is there a way to code in Fortran which finds the staring LINE of Velocity values and ending LINE of values or I have to manually find the lines?

IN this case it should return Starting line : 9 Ending line: 11
PHP Code:
Pressure
1 2 4
2 3 5
3 4 5
4 4 6
5 5 4

Velocity
1 2 0 
1 3 0 
4 4 5 
Thanks in advance
 
Old 06-24-2011, 12:40 AM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
I'm not sure what you're asking...
...but there's really only one answer:

* you open the file and read until you find 'Velocity'
* you keep reading until you find a blank line
* then you stop

'Hope that helps .. PM
 
Old 06-24-2011, 01:13 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
Old 06-24-2011, 03:38 AM   #4
parekhharsh_j
LQ Newbie
 
Registered: Jun 2011
Posts: 20

Original Poster
Rep: Reputation: Disabled
I am new to this forum and still getting used to it. Hence when I posted this query in the linux newbie forum someone said I was better off posting it in programing forum and I re posted. Il post in relevant forum next time.
 
Old 06-24-2011, 03:43 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
No problem! The best way to move a thread to another forum is to report your own post (see the REPORT button in the lower-right corner of your posts) and ask a moderator to move the thread to the desired forum. I have already moved the other thread to the programming forum.
 
Old 06-24-2011, 12:37 PM   #6
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
Follow the discussion here: http://www.linuxquestions.org/questi...riable-887905/

closing as duplicate
 
  


Closed Thread


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
Fortran. How to automatically find the starting and ending line of desired variable parekhharsh_j Programming 2 06-23-2011 07:36 AM
gnome-terminal is starting up in / konsole and xterm start up in ~ as desired dasy2k1 Linux - General 2 08-02-2010 08:43 PM
Problem in getting the starting and ending of a particular record from a file. vigneshinbox Programming 6 04-02-2009 11:28 PM
Execute desired line from the file say_hi_ravi Programming 2 04-09-2008 07:37 AM
Removing Text in a single line starting with one pattern ending on another mgwheeler Programming 13 08-03-2004 04:36 PM


All times are GMT -5. The time now is 11:41 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration