File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Need help with looping in Bash Shell Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Need help with looping in Bash Shell Script" Watch "Need help with looping in Bash Shell Script" New topic
Author

Need help with looping in Bash Shell Script

Kishen Singh Punjabi
Ranch Hand

Joined: Sep 14, 2012
Posts: 65
Hi,

I am storing the results from DB in an array.

For example ,

Records from DB are as follows:
This is Record One
This is Record Two


when I store the above records in a array and print , it is displayed something as follows:
This is Record One This is Record Two

and when I use for loop for this I get 8 elements with each record split into 4. I understand that this is because for loop takes space as the separator of elements in the array.

I want to store each record from the database as an element in array.

Please help on how do I achieve it. Thanks for the help!!



Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Per this page, quoting allows embedding white space in array elements. There may be other helpful hints on that page if this one is not sufficient.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
 
Consider Paul's rocket mass heater.
 
subject: Need help with looping in Bash Shell Script
 
Similar Threads
Assignment quality
weird CREATE method !!!
arrayList display all in one row
Reading Record by Rec Number
simple sorting algorithm