pipe: Pipe text to system commands

pipeshellR Documentation

Pipe text to system commands

Description

pipeshell() and ⁠%P%⁠ send x to command via shell.

less() print x in getOption('pager'). The operation is in-memory and efficient than page(x, method='print') that involves a temporary file.

egrep() and ⁠%G%⁠ are shorthand for x %P% "grep -E {expr}".

redirect() evaluates expr while sink(file) is in operation.

Usage

pipeshell(x, command, ...)

x %P% command

less(x, ...)

egrep(x, expr, ...)

x %G% expr

redirect(expr, file = nullfile())

Arguments

x

an object to print

command

to which the text is sent; string or expression.

...

further arguments passed to print

expr

arguments to grep -E; string or expression.

file

a writable connection or a character string naming the file to write to, or NULL to stop sink-ing.

Examples

iris |> less()
iris |> egrep(vir)
iris |> egrep("vir")
letters |> pipeshell(cat)

iris %P% wc
iris %P% "wc -l"
iris %P% `grep seto | less`

vir = "seto"
iris %G% vir
iris %G% !!vir
iris %G% `-v seto | less`

heavywatal/rwtl documentation built on April 29, 2024, 2:02 a.m.