Skip to content

Text

Index

text::remove_ansi

Strip ANSI escape sequences from stdin or a file. Output: stdout — text with ANSI codes removed expected to pipe to this function: ex my_command | text::remove_ansi

Arguments

  • $1 (file): path (optional; reads stdin if omitted)

text::remove_empty_lines

Remove blank lines (empty or whitespace-only) from stdin or a file. Output: stdout — text with blank lines removed

Arguments

  • $1 (file): path (optional; reads stdin if omitted)

text::first_line

Print the first line of stdin or a file. Output: stdout — first line of input

Arguments

  • $1 (file): path (optional; reads stdin if omitted)

text::last_line

Print the last line of stdin or a file. Output: stdout — last line of input

Arguments

  • $1 (file): path (optional; reads stdin if omitted)

text::skip_first_lines

Print all lines after the first N lines of stdin or a file. With stdin: $1 = number of lines to skip. With file: $1 = file path, $2 = number of lines to skip. Output: stdout — remaining lines after the skipped prefix

Function has no arguments.