|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a take a text file input and scan through each line.
the contents of each line become a variable which I need to use to run some 15-20 queries against a Sybase db. The the loop should read next line for execution of same queries against this new variable(new line) How do I go around this. I am new to scripting and this seems a relatively easy Q. All suggestions are welcome. |
|
#2
|
|||
|
|||
|
We can get line by line from a input file as,
while read line; do echo $line done < <inputfile> Example: Inputfile ------- ls hostname uname -a while read line; do echo $line | sh done < inputfile It will execute every commands using with shell there. To make this to be used on sybase queries then, while read line; do query $line | sh done < inputfile IF you try to use as, query $line it will not be executed. IT will only print the query and $line string there. We are executing combined informations again with | sh there. HTH. REgards Muthukumar |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Looping through text file input with sybase queries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|