Command which count rows of a txt file

_ROOT Version: 5.26
Platform: Not Provided
Compiler: Not Provided

Hello rooters,
I have a txt file which contains some columns. At first, I need to count number of columns and rows of this txt file. And then I need to write number of each row (as a column) in that txt (or write in dat or root file).
I would appreciate your help.
Thank you

awk '{print NF}' file.txt | tee file.columns.txt | wc -l > file.rows.txt

Mr. Coyote, thank you.
But I did not understand. I do not know how to use of this commands.

I write:

TTree *MyTree=new TTree(“MyTree”,“MyTree”);

How can I use of “awk” and “tee”? when I write them in ROOT, it makes error.



ROOT Forum -> Search -> ReadFile

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.