Find count of rows in excel sheet in Unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find count of rows in excel sheet in Unix
# 1  
Old 01-25-2012
Find count of rows in excel sheet in Unix

Hi,

Is there a way to find the count of number of rows of a.txt please? Where a.txt is as follows:

Code:
/usr/bin/uuencode /tmp/a.csv a.csv > /tmp/a.txt
#a.csv is a comma separated variable file

Cheers,
Girish.
# 2  
Old 01-25-2012
Code:
wc -l < /tmp/a.txt

--ahamed
# 3  
Old 01-25-2012
Code:
wc -l  /tmp/a.txt

# 4  
Old 01-25-2012
The file a.txt is encoded due to the command uuencode.
Hence the count of a.csv does not match a.txt using the following:

Code:
wc -l a.txt
# the abouve count is not equal to the below
wc -l a.csv

I need to find the actual count of a.txt which should be equal to a.csv.
Please insert some random values in a.csv and check. For example:

Code:
cat > a.csv
aaaaaaa,aaaaaaaaa,aaaaaaaaaaaa,aaaaaaaaaaaa,aaaaaaaaaaaaa,aaaaaaaaaaaaa
bbbbbbbbbb,bbbbbbbbbbb,bbbbbbbbbbbb,bbbbbbbbbbbb,bbbbbbbbbb,bbbbbbbbb
cccccccccccccc,ccccccccccc,ccccccccccc,cccccccccccc,cccccccccccc,cccccccccc
ddddddddddddd,ddddddddddd,ddddddddd,ddddddddddddd,ddddddddd,ddddddddddd
CTRL+d

$ /usr/bin/uuencode /tmp/a.csv a.csv > /tmp/a.txt
$ wc -l a.csv a.txt
       4 a.csv
      10 a.txt
      14 total
$

# 5  
Old 01-25-2012
I don't think that makes any sense!

--ahamed
# 6  
Old 01-25-2012
Count of a.csv is 4 and count of a.txt should be 4 as both have 4 rows.

Is there any command or way so that I get the count of a.txt as 4, please?

wc -l will not work here for a.txt as it gives the count of number of lines and not the number of actual rows.

---------- Post updated at 11:22 AM ---------- Previous update was at 10:47 AM ----------

Can do it using uudecode :

Code:
uudecode -p b.txt | wc -l

Cheers,
www.
# 7  
Old 01-25-2012
That is as good as counting the plane txt file isn't it?

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

2. UNIX for Dummies Questions & Answers

UNIX data to be updated to ms excel sheet

hi, i wanted to add unix data to be updated to the excel sheet. (3 Replies)
Discussion started by: rupesh.bombale
3 Replies

3. UNIX for Dummies Questions & Answers

Load UNIX data into excel sheet

Hi, i have some data in a temporary file in Unix (the data is taken from the result of an SQL query). Now i want to dump that data into an excel sheet. How to do that. Someone please advise. Thanks Regards, Vinit (3 Replies)
Discussion started by: vinit raj
3 Replies

4. Shell Programming and Scripting

Perl : to get all the hyperlinks from the xlsx sheet(hyperlinks not visible in excel sheet directly)

Hi folks, I have a requirement in perl to print all the hyperlink from the spreadsheet(xlsx). Spreadsheet contains few lines of hyperlink data (pic attached). P.S. Hyperlink is behind the data and not visible in excel sheet directly. Now using perl script I need to copy the hyperlinks in... (3 Replies)
Discussion started by: scriptscript
3 Replies

5. Shell Programming and Scripting

Perl :Is it possible to read the excel 2007 sheet on unix machine using spredsheet::xlsx module

I have an Excel 2007 excel sheet on windows machine and using Spreadsheet::XLSX I had written a script to read the excel sheet and was successful. My requirement is I need to generate another excel sheet from the old excel 2007 sheet on unix machine. Now is it possible to read the excel... (2 Replies)
Discussion started by: giridhar276
2 Replies

6. Shell Programming and Scripting

How to check count of rows in excel sheet in Unix

Hi, Would anyone be able to tell me how to check the number of rows in an excel sheet on unix box, please? Cheers, Girish. (2 Replies)
Discussion started by: girish1428
2 Replies

7. Shell Programming and Scripting

HOWTO create in UNIX a Microsoft Excel-Sheet (with data from Oracle)

Hi HOWTO create in UNIX a Microsoft Excel sheet (with data from Oracle). At the moment I am making CSV files (using SQL statemens with || ';'), but search for more advanced formatting. Don't wish to use Perl. cheers (4 Replies)
Discussion started by: slashdotweenie
4 Replies

8. Shell Programming and Scripting

Excel sheet to be created from unix.

Hi Guys, I like to create a excel sheet with four tabs. Is it possible to create it. Acutually i want to apply formulas in fourth tab which uses the three different tabs. Is it possible to create such a script? Thanks & regards, Magesh (3 Replies)
Discussion started by: mac4rfree
3 Replies

9. Shell Programming and Scripting

Read window Excel sheet to unix

I would like to read data from excel sheet as a input to a shell script. Myproblem is the excel sheet is in windows. How can I write a shell script to read data from that excel sheet? How can I do that?. (4 Replies)
Discussion started by: vj8436
4 Replies

10. UNIX for Advanced & Expert Users

Exporting files from unix to Excel sheet

How can we export a file in unix with certain number of columns to an excel sheet. It's very useful in time saving...... (3 Replies)
Discussion started by: bishweshwar
3 Replies
Login or Register to Ask a Question