lineEnding: Convert Between DOS and UNIX Line Endings

View source: R/lineEnding.R

lineEndingR Documentation

Convert Between DOS and UNIX Line Endings

Description

This function converts between DOS and UNIX style line endings by invoking unix2dos (or dos2unix) upon a text file (see also system("unix2dos --help")). Note that 'unix2dos' must be installed on your local system, see Source.

Usage

lineEnding(infile, pattern = NULL, outfile = NULL, to = c("dos", "unix"), ...)

Arguments

infile

Input filename(s).

pattern

See list.files(). This will be ignored if 'infile' is specified.

outfile

Output filename. If not supplied, 'infile' will be overwritten.

to

Either "dos" or "unix".

...

Additional arguments passed to list.files(), only applicable if 'infile' is not specified.

Author(s)

Florian Detsch

Source

Dos2Unix/Unix2Dos Text file format converters.

See Also

list.files(), system().

Examples

## input file
infile <- paste(system.file(package = "Orcs"), "DESCRIPTION", sep = "/")

## convert to dos line endings and write to output file
ofl = file.path(tempdir(), "DESCRIPTION4wd")
lineEnding(infile, outfile = ofl, to = "dos")


fdetsch/Orcs documentation built on Jan. 9, 2023, 6:14 a.m.