lib/reports.cf

Table of Contents

printfile bodies

cat

Prototype: cat(file)

Description: Report the contents of a file

Arguments:

  • file: The full path of the file to report

Implementation:

body printfile cat(file)
{
        file_to_print => "$(file)";
        number_of_lines => "inf";
}

Prototype: head(file)

Description: Report the first 10 lines of a file

Arguments:

  • file: The full path of the file to report

Implementation:

body printfile head(file)
{
        file_to_print => "$(file)";
      # GNU head defaults to 10
        number_of_lines => "10";
}

head_n

Prototype: head_n(file, n)

Description: Report the first n lines of a file

Arguments:

  • file: The full path of the file to report
  • n: The number of lines to report

Implementation:

body printfile head_n(file, n)
{
        file_to_print => "$(file)";
        number_of_lines => "$(n)";
}

tail

Prototype: tail(file)

Description: Report the last 10 lines of a file

Arguments:

  • file: The full path of the file to report

Implementation:

body printfile tail(file)
{
        file_to_print => "$(file)";
      # GNU tail defaults to 10
        number_of_lines => "-10";
}

tail_n

Prototype: tail_n(file, n)

Description: Report the last n lines of a file

Arguments:

  • file: The full path of the file to report
  • n: The number of lines to report

Implementation:

body printfile tail_n(file, n)
{
        file_to_print => "$(file)";
        number_of_lines => "-$(n)";
}