Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find line number in a file using multi line string

 
rajareddya reddy
Ranch Hand
Posts: 61
  • 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: 115
2
  • 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
Posts: 3355
12
Android Java
  • 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
Posts: 3355
12
Android Java
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic