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!
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.
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
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.
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