Having trouble with my linux homework
I am taking Liunx Fundamentals to learn Linux. I am having trouble with 2 questions in an assignment. Attached is a text file of the classic Sherlock Holmes story, The Speckled Band. Complete the following steps.
1. Find how many times the word band is used in story (using command line tools, no graphical methods). 2. Number the lines in the story so that the numbered lines are saved I thought maybe grep for the first one but it only counted band in each line, not multiple instances in a line. I know how to number the lines but it's the saved part that's throwing me off. Any help appreciated. |
for 1
have a look at "cat" and "grep" the same for 2 and write a shell script http://www.tldp.org/LDP/abs/html/ http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html |
never mind misread the op
|
aslo for
Quote:
the number of lines is dependent on the Number of characters in YOUR terminal ( seeing as you can NOT use a gui ) the lines in VI will change on how wide the terminal is |
For question 2, look at the nl command, e.g. man nl.
For question 1, consider using the -o option of grep and piping the output into wc with the appropriate option. Something like grep -io band <file> | wc <option> |
Cheater. :eek: :)
|
I would like to thank everyone who gave useful hints that helped point me in the right direction. To the person who called me a cheater, asking for help on a new concept you don't understand is NOT cheating. Cheating is getting the answer with no work involved. If you can't contribute something useful don't bother contributing anything at all.
|
Sorry if you misunderstood the smiley face (And\or, didn't like the text? I love #6+) but people were smart enough to NOT outright give the answers you asked for... :hattip:
|
Really? Linking study tips for dummies not meant to be insulting? What planet are you from? Plus never asked for answers asked for any help appreciated. And what I meant by that is I'm lost, this is what I did, throw me in the right direction. Which is what most people did. I stand by post if you're not going to post a useful reply then why bother posting?
|
Quote:
|
Quote:
|
No. You think I was trying to insult (instead of tease) you by not (looking past the title) seeing the big picture, of which I clarified\apologized; making you the one under the bridge now... Get Over It! :banghead:
|
All times are GMT -5. The time now is 06:37 AM. |