trim.file: Remove Empty Lines from a File

View source: R/trim_file.R

trim.fileR Documentation

Remove Empty Lines from a File

Description

This function reads a text file, removes all empty lines, and saves the modified content back to the same file.

Usage

trim.file(file_path, resave = TRUE)

Arguments

file_path

A character string specifying the path to the text file.

resave

A logical value indicating if the file content should be resaved or returned

Value

NULL This function modifies the file in place and does not return a value.

Examples


if(interactive()){
# Remove empty lines from a file
trim.file("path/to/your/file.txt")
}


quickcode documentation built on April 11, 2025, 5:49 p.m.