Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
09-14-2013, 02:15 PM
|
#1
|
LQ Newbie
Registered: Sep 2013
Posts: 4
Rep: 
|
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.
|
|
|
09-14-2013, 02:54 PM
|
#2
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673
|
|
|
|
09-14-2013, 04:53 PM
|
#3
|
Member
Registered: Mar 2011
Distribution: Slackware 64 -current,
Posts: 550
Rep: 
|
never mind misread the op
Last edited by fogpipe; 09-14-2013 at 05:04 PM.
|
|
|
09-14-2013, 05:27 PM
|
#4
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673
|
aslo for
Quote:
2. Number the lines in the story so that the numbered lines are saved
|
the lines or sentences ???
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
|
|
|
09-14-2013, 06:54 PM
|
#5
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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>
|
|
|
09-14-2013, 10:24 PM
|
#6
|
Senior Member
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
|
|
|
|
09-15-2013, 06:45 AM
|
#7
|
LQ Newbie
Registered: Sep 2013
Posts: 4
Original Poster
Rep: 
|
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.
|
|
|
09-15-2013, 08:50 AM
|
#8
|
Senior Member
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
|
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... 
Last edited by jamison20000e; 09-15-2013 at 09:12 AM.
|
|
|
09-15-2013, 11:52 AM
|
#9
|
LQ Newbie
Registered: Sep 2013
Posts: 4
Original Poster
Rep: 
|
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?
|
|
|
09-15-2013, 12:06 PM
|
#10
|
Senior Member
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
|
Quote:
Originally Posted by ruthmom1979
Really? Linking study tips for dummies not meant to be insulting? What planet are you from? ...
|
Sorry you feel that way. Your missing very useful info by not looking into the "Dummies" series for smart people! For the record, when I started school that document was the first best help I found it's also the fith link on my blog... there, is also my statement: There are infinite ways to look at anything we can only comprehend "our" own—Get Over It! 
Last edited by jamison20000e; 09-15-2013 at 12:09 PM.
|
|
|
09-15-2013, 12:16 PM
|
#11
|
LQ Newbie
Registered: Sep 2013
Posts: 4
Original Poster
Rep: 
|
Quote:
Originally Posted by jamison20000e
Sorry you feel that way. Your missing very useful info by not looking into the "Dummies" series for smart people! For the record, when I started school that document was the first best help I found it's also the fith link on my blog... there, is also my statement: There are infinite ways to look at anything we can only comprehend "our" own—Get Over It! 
|
Never said the Dummies series wasn't useful. You were the one making the assumption that was the "help" I needed. What I think is best is that you don't reply to any of my post and go back to self important world and troll someone else's posts.
|
|
|
09-15-2013, 12:32 PM
|
#12
|
Senior Member
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
|
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! 
Last edited by jamison20000e; 09-15-2013 at 12:53 PM.
|
|
|
All times are GMT -5. The time now is 09:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|