• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find line number in a file using multi line string

 
rajareddya reddy
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which database are you using ?

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

ROW_NUMBER
 
K. Tsang
Bartender
Pie
Posts: 3222
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Bartender
Pie
Posts: 3222
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic