LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-23-2008, 11:50 AM   #1
rajdey1
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Rep: Reputation: 0
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
 
Old 11-23-2008, 12:23 PM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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/
 
Old 11-24-2008, 12:00 PM   #3
salter
Member
 
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
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.

Last edited by Tinkster; 10-30-2010 at 05:14 PM.
 
Old 11-24-2008, 02:28 PM   #4
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
grep and wc can solve this for you as well
 
Old 11-24-2008, 02:32 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 11-24-2008, 02:58 PM   #6
kr4ey
Member
 
Registered: May 2007
Location: Florida
Distribution: Slackware64 14.1
Posts: 58

Rep: Reputation: 17
Quote:
Originally Posted by pixellany View Post
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.
 
Old 11-24-2008, 05:49 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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!
 
Old 11-24-2008, 07:50 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by kr4ey View Post
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.
 
Old 11-25-2008, 07:20 AM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by kr4ey View Post
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.
 
Old 11-25-2008, 05:57 PM   #10
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
[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.
 
Old 11-25-2008, 06:09 PM   #11
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by estabroo View Post
[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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
filter a data sheet for blank spaces tjgadu Linux - Newbie 2 04-20-2006 11:39 AM
Display line number n from a file doctorwebbox Linux - Newbie 2 01-05-2005 02:06 PM
Problem with SED and blank spaces BigLarry Programming 2 06-10-2004 04:57 AM
mp3 files - replacing blank spaces with _ script? mymojo Linux - Newbie 4 12-08-2003 03:33 AM
RH9 Shrike /sbin/loader display problem with SIS 630 laptop - display is blank ! johnvoisey Red Hat 4 11-01-2003 06:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration