doc date 19990412

NAME

pluck -- delete specified characters

SYNOPSIS

pluck [-c | --complement ] string_arg <_standard_redirection_>

DESCRIPTION

pluck is part of the functionality of tr , split into a separate command in cLIeNUX for clarity. This is done by tr, which asks the environment what name it was invoked as. This version is very stupid, and won't understand "./pluck" to be "pluck", for example. UnLESS I fixed the code to take the tail of argv[0] by the time you read this.

pluck removes characters specified by string_arg from standard input and sends the remainder to standard output. string_arg specifies a list of ASCII characters. Most characters may represent themselves, and there are aliases for backslash escapes including octal ASCII values, "asciibetical" ranges of characters like A-Z and named character classes. You'll have to use \\ to specify a backslash to be pluckd, for example. see tr for full cryptic details.

The complement switch causes the character set to be plucked to be all the ASCII characters not specified by string_arg.

Splitting tr into 3 commands is done as an example of what Forth programmers call "factoring". Although the modes of tr are somewhat naturally grouped by the underlying code they need, in terms of usage and invocation switches having all 3 modes in one command is exemplary of poor factoring. It was almostm easier to break them into separate commands than to lucidly document them as one command.

EXAMPLES

Several of these use Bash << "here-document" redirection interactively.

$pluck - <<_ppp
> --------etuhkb
> _ppp
etuhkb

(the _'s are just so the html works in the seedoc )

$pluck A-J <<_bla
> w;emukxnoehtxk.gxrNATEIACOEGAO
> bla
w;emukxnoehtxk.gxrNTOO

$pluck -c j < COPYING
jjjjjjj$

$pluck "\n" <<_bla
> eotu uix
> ehtuibx ubix
> tuhix tuihbx thuibx iuthx
> eiu
> _bla
eotu uixehtuibx ubix tuhix tuihbx thuibx iuthx eiu$ cLIeNUX0 /dev/tty7 r / 02:03:24

SEE ALSO

tr exchange squeeze sed awk/gawk and GNU "info" on gawk, dirname basename

BUGS

I *just* hacked up the little mutant. It still gives on-line help for tr with the --help switch.

RIGHTS

pluck is a derived work of GNU tr. This seedoc is not. This document is Copyright 1999 Richard Allen Hohensee. This seedoc is released for redistribution only as part of an intact entire cLIeNUX Core.