Count all columns in a given file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Count all columns in a given file
# 1  
Old 07-30-2010
Count all columns in a given file

Hi,

I have a file where i have dump of a DB. it has all the columns and rows inside that. I wanted to extract the columns and number of columns from that dump.
Any suggestions will be helpful.

Thanks
# 2  
Old 07-30-2010
Hi,

Post your sample input and expected output.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Count columns that are non-empty per line

The file is similar to the attached. Thousands of columns, delimiter is tab, with many columns containing free text and space separated. I want to get the count of columns with non-empty entries. eg.Col1=10, Col6=5, Col8=1 awk preferred (7 Replies)
Discussion started by: genehunter
7 Replies

2. UNIX for Beginners Questions & Answers

Copy columns from one file into another and get sum of column values and row count

I have a file abc.csv, from which I need column 24(PurchaseOrder_TotalCost) to get the sum_of_amounts with date and row count into another file say output.csv abc.csv- UTF-8,,,,,,,,,,,,,,,,,,,,,,,,, ... (6 Replies)
Discussion started by: Tahir_M
6 Replies

3. UNIX for Beginners Questions & Answers

Count multiple columns and print original file

Hello, I have two tab files with headers File1: with 4 columns header1 header2 header3 header4 44 a bb 1 57 c ab 4 64 d d 5 File2: with 26 columns header1.. header5 header6 header7 ... header 22...header26 id1 44 a bb id2 57 ... (6 Replies)
Discussion started by: nans
6 Replies

4. UNIX for Dummies Questions & Answers

How to count specific columns and merge with unique ones?

Hi. I am not sure the title gives an optimal description of what I want to do. I have several text files that contain data in many columns. All the files are organized the same way, but the data in the columns might differ. I want to count the number of times data occur in specific columns,... (0 Replies)
Discussion started by: JamesT
0 Replies

5. Shell Programming and Scripting

Count Columns and If less add new column

Hi All, My Input.txt should have always 4 columns in some cases i may not get all the 4columns data. My requirement is if columns as not equal to 4 then append new column delimiter. Input.txt A,1,2 B,1,2,3 C,1 Desired output should be in below format Output.txt A,1,2,... (3 Replies)
Discussion started by: kmsekhar
3 Replies

6. Shell Programming and Scripting

Difference between two columns and count

hi I am very new to shell scripting. i wanted to achieve this.. Col1 Col2 Col3 Col4 aa 23 bb 32 aa 34 bb 12 aa 45 bb 345 kk 20 ss 50 kk 30 ss 50 tt 10 vv 50 Desired output is Col1 Col2 Col3 Col4 Difference Count aa 23 bb ... (1 Reply)
Discussion started by: empyrean
1 Replies

7. Shell Programming and Scripting

Columns count

I'm writting a script that will get the logical volumes from a volume group and check for mirroring. I'm using a while read line command. I need to be able to count the columns for the output and if it is <= 3 save the logical volume to a file and if it is > 3 continue. How do I capture the... (1 Reply)
Discussion started by: daveisme
1 Replies

8. Shell Programming and Scripting

perl: count columns/words in a string

Hi there, I just wanted to know whether there was an easy way of checking the number of white space separated columns or words in a provided string (scalar) without turning it into an array for example if I have a string like this $string="a b c d 6"; obviously if i was using an array i... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

9. Shell Programming and Scripting

Count minimum columns in file

Hi All, Consider the file with following lines: 1,2,3,4 1,2,3, 5,6,7,7,8,9 1 I need to get the count of minimum columns per line. i.e. in above case, it should come out to be 1 since the last line only has 1 column. I tried following code: minCount = 0 wordCountPerLine = 0... (12 Replies)
Discussion started by: sh_kk
12 Replies

10. Shell Programming and Scripting

Count first column on the basis of two other columns

Hello, I have a file ================= 12 SRV1 GRP1 19 SRV1 GRP1 19 SRV1 GRP2 3 SRV1 GRP1 3 SRV1 GRP2 30 SRV1 GRP2 7 SRV1 GRP1 8 SRV1 GRP3 =========== I want output like =============== 41 SRV1 GRP1 52 SRV1 GRP2 8 SRV1 GRP3 (1 Reply)
Discussion started by: kaustubh137
1 Replies
Login or Register to Ask a Question