Meaningless Drivel is fun!*
The moose likes I/O and Streams and the fly likes Find line number in a file using multi line string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Find line number in a file using multi line string" Watch "Find line number in a file using multi line string" New topic
Author

Find line number in a file using multi line string

rajareddya reddy
Ranch Hand

Joined: Jul 23, 2011
Posts: 54
Dear All,

My requirement is to find the line number using multiline string. Here I need to extract the string between FROM and where clause(from the below string) and need to find the line number in the file
Please help.








File Code:




Edson Cezar
Ranch Hand

Joined: Mar 05, 2011
Posts: 75
    
    1
Which database are you using ?

If you are using SQL Server, Have you tried using ROW_NUMBER ?

ROW_NUMBER
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2596
    
    9

@Edson Not sure how row_number() will help. Row_number() gives the row number of the result set not the sql itself in the editor per se.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2596
    
    9

Have you checked out BufferedReader or BufferedLineReader? Reading a file is rather simple. Checking the line for "FROM" and "WHERE" should again be straight forward.

Have you checked out the I/O java tutorials?
 
 
subject: Find line number in a file using multi line string