1YANK(1)                   BSD General Commands Manual                  YANK(1)
2

NAME

4     yank — yank terminal output to clipboard
5

SYNOPSIS

7     yank [-lx | -v] [-d delim] [-g pattern [-i]] [-- command [argument ...]]
8

DESCRIPTION

10     Read input from stdin and display a selection interface that allows a
11     field to be selected and copied to the clipboard.  Fields are either rec‐
12     ognized by a regular expression using the -g option or by splitting the
13     input on a delimiter sequence using the -d option, see DELIMITERS.
14
15     Using the arrow keys will move the selected field, see COMMANDS.  Press‐
16     ing the return key will invoke command and write the selected field to
17     its stdin.  The command defaults to xsel(1) but could be anything that
18     accepts input on stdin, see EXAMPLES.
19
20     The options are as follows:
21
22     -d delim
23             All input characters not present in delim will be recognized as
24             fields, see DELIMITERS.
25
26     -g pattern
27             Use pattern to recognize fields, expressed as a POSIX extended
28             regular expression.
29
30     -i      Ignore case differences between pattern and the input.
31
32     -l      Use the default delimiters except for space, see DELIMITERS.
33
34     -v      Prints version.
35
36     -x      Use alternate screen.
37
38     -- command [argument ...]
39             Use command with zero or more args as the yank command.
40

COMMANDS

42     Ctrl-A | g
43           Move selection to the first field.
44
45     Ctrl-C | Ctrl-D
46           Exit without invoking the yank command.
47
48     Ctrl-E | G
49           Move selection to the last field.
50
51     Ctrl-P/Ctrl-N | Left/Right | h/l
52           Move selection to the left or right.
53
54     Up/Down | j/k
55           Move selection to the next or previous line.
56
57     Enter
58           Exit using the selected field.
59

DELIMITERS

61     If the -d and -g options are omitted the following characters are recog‐
62     nized as delimiters by default:
63
64     \f    form feed
65
66     \n    new line
67
68     \r    carriage return
69
70     \s    space
71
72     \t    horizontal tab
73
74     If the -d option is present space is not recognized as a delimiter.
75

EXAMPLES

77     Yank an environment variable key or value:
78
79           $ env | yank -d =
80
81     Yank a field from a CSV file:
82
83           $ yank -d \", <file.csv
84
85     Yank a whole line using the -l option:
86
87           $ make 2>&1 | yank -l
88
89     If stdout is not a terminal the selected field will be written to stdout
90     and exit without invoking the yank command.  Kill the selected PID:
91
92           $ ps ux | yank -g [0-9]+ | xargs kill
93
94     Yank the selected field to the clipboard as opposed of the default pri‐
95     mary clipboard:
96
97           $ yank -- xsel -b
98

DIAGNOSTICS

100     The yank utility exits 0 on success, and >0 if an error occurs.
101

SEE ALSO

103     re_format(7)
104

AUTHORS

106     Anton Lindqvist <anton.lindqvist@gmail.com>
107
108BSD                              June 20, 2019                             BSD
Impressum