|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
Join Date: May 2000
Posts: 219
|
Hi, I'm fairly new at shell scripting and I'm trying to create a small menu system for someone. It's a small script that is designed to analyse a file containing some text. (using Linux, Mandrake 7.2 to be precise).
I'm currently stuck on the following items: 1) I'm trying to get a specific letter count. For example, if someone wanted to count the number of 'f' in a text file, how would I do that. 2) How do I do aword count that can be specified, for example 'milk' in a text file. 3) A sentence count. 4) Add an extra line to the text 5) Replace a word in a text I know it has something to do with grep, sed and wc, but I can't get around to piping them correctly. Just one other thing, How do I get a menu system to work? I currently have a menu system that you can chose options such as: [1] Open file [2] List File [3] Word count I did this using functions but after the menu function has been executed once, then I call it from another function it doesn't seem to work, this is how my structure is: function menu { menu code option1 #this line calls the function option } menu #this line calls the function menu above function option1 { Option code menu # this line is the problem, it calls the function, but the menu function doesn't work properly } Thank you for any help
|
|
|
|
|
|
#2 |
|
Member (8 bit)
Join Date: May 2000
Posts: 219
|
Anyone?
|
|
|
|
|
|
#3 |
|
Member (9 bit)
Join Date: Jan 2000
Location: Atwater Mn. USA
Posts: 429
|
Honestly I don't have an answer myself. But I know that somebody over at linuxjunior.org will.
OOPS!
__________________
If you think you understand what's going on. Then you haven't been paying attention. |
|
|
|
|
|
#4 |
|
Member (4 bit)
Join Date: Mar 2002
Location: Denver
Posts: 14
|
Hi, I saw your message and I'm working on this. Instead of saying
"Use grep then add some more commands using awk, and sed....bla, bla..." I'm working on a script based on your questions so that I can give you some ideas for your project. Hope to have an answer soon. |
|
|
|
|
|
#5 |
|
Member (8 bit)
Join Date: May 2000
Posts: 219
|
Thanks alot you guys. Abrakadabra thanks for your help, I just need some simple grep or sed or wc commands to help me work this out, if you know any other way please let me know. I appreciate this very much.
|
|
|
|
|
|
#6 |
|
Member (4 bit)
Join Date: Mar 2002
Location: Denver
Posts: 14
|
Hey, here is some info I found for you. Since I'm not sure exactly how you want your scrip to look like, I was searching some of my favorites for tips on what you want and found this link. Although is for bash scripting you can make the necessary changes if you are using a different shell. http://linuxdoc.org/LDP/abs/html/
Hope this helps. Let me know. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|