LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 04-16-2014, 08:13 AM   #1
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Rep: Reputation: Disabled
counting the rows in calc


how to counting the rows

see the example..

shop name
supermarket Netto
supermarket Penny
supermarket Rewe
supermarket netto
supermarket Lidl
supermarket Netto

is there an easy way to do this
 
Old 04-16-2014, 11:02 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,685

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by sayhello_to_the_world View Post
how to counting the rows see the example..

shop name
supermarket Netto
supermarket Penny
supermarket Rewe
supermarket netto
supermarket Lidl
supermarket Netto

is there an easy way to do this
There are several ways to do this, but you don't tell us what you're wanting to use. Perl? Bash? Ruby? What is your delimiter between the 'rows'? What have you done/tried on your own?? What are you trying to accomplish?

You can easily use sed and awk to get the maximum number of columns, by counting the delimiters. Running it through sort and head would return just the highest number.
Code:
sed 's/[^<some delimiter>]//g' <file name> | awk '{ print length }' | sort -r | head -n 1
Please try to show some effort of your own first.
 
Old 04-21-2014, 08:34 AM   #3
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
He said "calc" right. I think that means OO/Libre Calc.

Use COUNTA() function. Just COUNT() counts only numerics. COUNTA() counts text also and ignores empty cells. COUNTBLANK() returns the number of empty cells.

OK
 
Old 04-21-2014, 10:32 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,685

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by AnanthaP View Post
He said "calc" right. I think that means OO/Libre Calc.
Use COUNTA() function. Just COUNT() counts only numerics. COUNTA() counts text also and ignores empty cells. COUNTBLANK() returns the number of empty cells.
Or it could mean any program with 'calc' in the name...since the OP didn't say, and never followed up, it's hard to guess.

Either way, the count() solution you provided is a good one...but is also another that the OP could have easily looked up.
 
  


Reply



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
[SOLVED] awk certain rows sryzdn Linux - Newbie 1 10-06-2013 12:37 AM
awk comparing 2 rows and counting secret Linux - Newbie 7 03-12-2013 08:36 PM
Colorizing rows/columns in Open Office Calc hedron Linux - Software 3 06-09-2010 10:51 PM
Compare two fields on consecutive rows and print the two rows aditi_borkar Linux - Newbie 3 04-09-2009 05:49 AM
rows and columns digitalgravy Linux - General 2 03-16-2004 06:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 02:24 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