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

NAME

4     yank — yank terminal output to clipboard
5

SYNOPSIS

7     yank [-1ilxv] [-d delim] [-g pattern] [-- 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(1x) but could be anything that
18     accepts input on stdin, see EXAMPLES.
19
20     The options are as follows:
21
22     -1      If only one field is recognized, select it and invoke command
23             without displaying the selection interface.
24
25     -d delim
26             All input characters not present in delim will be recognized as
27             fields, see DELIMITERS.
28
29     -g pattern
30             Use pattern to recognize fields, expressed as a POSIX extended
31             regular expression.
32
33     -i      Ignore case differences between pattern and the input.
34
35     -l      Use the default delimiters except for space, see DELIMITERS.
36
37     -v      Prints version.
38
39     -x      Use alternate screen.
40
41     -- command [argument ...]
42             Use command with zero or more args as the yank command.
43

COMMANDS

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

DELIMITERS

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

EXAMPLES

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

DIAGNOSTICS

103     The yank utility exits 0 on success, and >0 if an error occurs.
104

SEE ALSO

106     re_format(7)
107

AUTHORS

109     Anton Lindqvist <anton@basename.se>
110

CAVEATS

112     Recognizing fields enclosed in brackets requires ‘]’ to be present before
113     ‘[’ in the argument given to the -d option, see re_format(7).
114
115BSD                              July 10, 2015                             BSD
Impressum