Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
yeah i have a database as i gave example above. i am trying to listing all that info as user want. so at first it will print out those titles and ask user if he/she wants in detail about that by entering number as i said.
if he/she enters 1 then it should print all info under it
-a
-b
-c
It seems that you want something like, if user enters 1, then it consider "abc bas" and print the info. that is just below this string (i.e. 4 lines below "abc bas"), and same if user enters 2, it considers "jhab kam"... and so on.
It is ok for a small file. But for a large database, you will need to assign a unique number to each user!! So, will your script user be able to remember number associated with the username entry that he/she's going to serach (I am assuming huge number of username entries in database)? I don't think so.
Instead of using numbers, you should better direct take username of the user whose database entries he/she's seaching, as input from him/her. Following may be helpful:
I am sorry if I have interpreted your requirement wrongly, but this is what it sounds to me. If it's not what you want, then better explain your requirement in detail with sample database file and sample output that your want.
Last edited by shivaa; 12-08-2012 at 01:09 PM.
Reason: Typo
yeah that can work but the question that i have it says use numbers. its like user to choose a username by entering the number, or to quit by entering a q
yeah that can work but the question that i have it says use numbers. its like user to choose a username by entering the number, or to quit by entering a q
What's correlation between username & numbers? Could you explain what's need of assign a number first and then search using that number? May be people can then better help you.
I feel that you're confused!! So as I said above, if pb has not been solved yet, then clearly mention everything, including sample db file, sample output you want, and your purpose of using numbers instead of usernames.
Also pls use correct grammer & punctuation in your post, so it can be easily understandable.
Last edited by shivaa; 12-08-2012 at 10:14 PM.
Reason: Line added
yeah that can work but the question that i have it says use numbers. its like user to choose a username by entering the number, or to quit by entering a q
Sounds very much like a homework question. Can you post what you've written/tried so far???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.