User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

Count Lines in Text File

Count Lines in Text File icon

Counts lines in a text file. Writes the line count into the task log and stores it into the following task variables:

  • TOTAL_LINE_COUNT: Total number of lines.

  • IGNORED_LINE_COUNT: Number of lines ignored based on matching with Ignored Row Reg Ex.

  • DATA_LINE_COUNT: Number of lines containing data (TOTAL_LINE_COUNT minus IGNORED_LINE_COUNT - Number Of Lines In Header minus Number Of Lines In Footer).

Properties

Name Type Description Expression support

Source File

mandatory

Name of the file containing the input data.

semi-expression

Encoding

mandatory

Source File data encoding. Possible encodings are all encodings supported by the target Java platform. Common encodings are: ISO-8859-1, ISO-8859-2, and UTF-8.

semi-expression

Line Separator

mandatory

Specifies the string to be recognized as a line delimiter.

The line delimiter can be any sequence of letters, although a specific symbol is often used, which usually depends on the operating system where the file originated from. The special symbols are: \r = CR, \l = LF, \n = LF.

none

String Qualifier

optional

String enclosing a text string. Not defined by default.

none

String Qualifier Escape

optional

Escape character escaping the String Qualifier in the original meaning of this character. Not defined by default. See Escaped string property.

none

Line Max Read Length

mandatory

Specifies the maximum number of characters per line to be read and processed. The task behavior in case a line length exceeds this number is configured by the Fail On Long Line property.

expression

Fail On Long Line

optional

Determines the task behavior in case a line length exceeds Line Max Read Length:

  • If set to true, the processing fails.

  • If set to false, warning is logged for the first 100 lines.

none

Ignored Row Reg Ex

optional

A regular expression that is evaluated against the lines of the input file. The lines (read as strings) that match the regular expression are ignored.

none

Number Of Lines In Header

mandatory

Specifies the number of lines from the beginning of the file that are excluded from processing (such as header lines, comments).

expression

Number Of Lines In Footer

mandatory

Specifies the number of lines from the end of the file that are excluded from processing (footer lines).

expression

Progress Interval

optional

If a value (number of lines read) for the progress interval is defined, the task logs its progress after reading an integer multiple of Progress Interval lines. For example, if the value is 100, the task logs its progress after reading 100, 200, 300 lines.

expression

Example

Count lines in file - Example

Escaped string property

A string property can allow to escape characters. The escape character is a backslash (\), which can be followed by:

Character Meaning

\

A single backslash (\)

n

New line

r

Carriage return

t

Tabulator

v

Vertical tabulator

u

Four-digit hexadecimal number that is Unicode code

x

Two-digit hexadecimal number that is Unicode code

Was this page useful?