Skip to main content
Justee
Silver ⭐️⭐️⭐️
Jun 1, 2021 10:46 AM UTC
Solved

How to count files lines using NiFi

Hi Everyone, I collect data files with NiFi using ListSFTP AND FetchSFTP processors. In these data files I have several different lines. I want to know if there is a processor that can allow me to count the number of lines in the files as I collect them to have a total number of lines. Someone can help me.
ckumar
ckumarAnswer
Platinum ⭐️
Jun 1, 2021 3:42 PM UTC

 I have used CSV file withCountText and it worked fine for me,  Upon success it will writes an attribute name "text.line.count" with number of lines as value, attaching sample csv file which I used to test and it has 6 lines. 

 

Screenshot 2021-06-01 at 9.10.22 PM.png

Screenshot 2021-06-01 at 9.18.35 PM.png

6 replies

ckumar
Platinum ⭐️
Platinum ⭐️
Jun 1, 2021 2:15 PM UTC

You can use processor name CountText

 

Thank You.

Translate
Justee
JusteeAuthor
Silver ⭐️⭐️⭐️
Jun 1, 2021 3:22 PM UTC

Hi @ckumar, Thanks for your help but I had used CountText but the problem is that I have csv files and I only see the number of files instead of counting the number of lines in the files.

Translate
ckumar
Platinum ⭐️
ckumarAnswer
Platinum ⭐️
Jun 1, 2021 3:42 PM UTC

 I have used CSV file withCountText and it worked fine for me,  Upon success it will writes an attribute name "text.line.count" with number of lines as value, attaching sample csv file which I used to test and it has 6 lines. 

 

Screenshot 2021-06-01 at 9.10.22 PM.png

Screenshot 2021-06-01 at 9.18.35 PM.png

Translate