LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   to display the number of blank spaces in a specified file (https://www.linuxquestions.org/questions/linux-newbie-8/to-display-the-number-of-blank-spaces-in-a-specified-file-685575/)

rajdey1 11-23-2008 11:50 AM

to display the number of blank spaces in a specified file
 
hi
please help me i want to write a command using pipe that will be enable to count blank spaces in a file

H_TeXMeX_H 11-23-2008 12:23 PM

This sounds like homework to me. So I will say that one way to solve this is by using 'sed' and 'wc', for more info see the man pages 'man sed', 'man wc' as well as:

http://www.grymoire.com/Unix/
http://tldp.org/LDP/abs/html/

salter 11-24-2008 12:00 PM

Even for a homework job a bit more info would be needed. Does it have to be done by standard command-line tools, or rather as a | Perl | PHP | Ruby | Python | <your favorite scripting here> | script? Maybe even as a compiled binary? There are a lot of ways to do it, depending where the project is heading to.

estabroo 11-24-2008 02:28 PM

grep and wc can solve this for you as well

pixellany 11-24-2008 02:32 PM

If you want help with homework, you need to do a minimum of two things:
1. Acknowledge that it is homework
2. Show us what work you have done.

kr4ey 11-24-2008 02:58 PM

Quote:

Originally Posted by pixellany (Post 3353097)
If you want help with homework, you need to do a minimum of two things:
1. Acknowledge that it is homework
2. Show us what work you have done.

That's bull. I don't see these requirements in the rules.

This is not school its the real world. Wake up.

homey 11-24-2008 05:49 PM

Quote:

This is not school its the real world. Wake up.
kr4ey, I can't think of any real world reason to count spaces or to be rude to a Moderator!

pixellany 11-24-2008 07:50 PM

Quote:

Originally Posted by kr4ey (Post 3353125)
That's bull. I don't see these requirements in the rules.

This is not school its the real world. Wake up.

OK---I'm awake.

Since you have read the rules, you know that the key statement is--in effect--that you cannot expect help on homework.

Since you have been here for a while, you also know that people DO very often get help on homework. If you read my statement as a criteria for getting help, maybe you can feel better.

If it helps, I'll stipulate that it is my opinion.

H_TeXMeX_H 11-25-2008 07:20 AM

Quote:

Originally Posted by kr4ey (Post 3353125)
That's bull. I don't see these requirements in the rules.

This is not school its the real world. Wake up.

Hey, if you wanna tell them the answer, go right ahead, I'm not stopping you, and the mods may not either. Just know that you are doing the OP a disservice by doing this.

estabroo 11-25-2008 05:57 PM

[slightly offtopic, but not really] You know it'd be kind of cool if you could have a man page give you information about just a particular option that an executable has, like say, man grep -o, and man would spit out a small grep description and that options description, or maybe it would be better if it gave just the description of the option since it would have to be a pretty good parser to pick out just one option like -c out of the wc man page. Ah well maybe someday someone will add that option to man.

colucix 11-25-2008 06:09 PM

Quote:

Originally Posted by estabroo (Post 3354335)
[slightly offtopic, but not really] You know it'd be kind of cool if you could have a man page give you information about just a particular option that an executable has, like say, man grep -o, and man would spit out a small grep description and that options description, or maybe it would be better if it gave just the description of the option since it would have to be a pretty good parser to pick out just one option like -c out of the wc man page. Ah well maybe someday someone will add that option to man.

Moreover, it can be useful if you can specify a topic as for man grep "character classes" and man spits out the relevant section of the man page, especially for very extensive pages.


All times are GMT -5. The time now is 07:32 PM.