0

The following sed returns (...| od -c) without ...|cut -d "\n" -f

0000000   1   9   2  \n   2   5   0  \n
0000010

Pseudocode

# http://unix.stackexchange.com/a/290407/16920
sed -n -f - /usr/share/X11/xkb/symbols/us <<END_SED | cut -d "\n" -f1 
/xkb_symbols "dvorak" {/,/^};/{
        /xkb_symbols "dvorak" {/=
        /^};/=
}
END_SED

but blank output.

System: Ubuntu 16.04 64 bit
Hardware: Macbook Air 2013-mid
Sed: 4.2.2
Cut, od: Coreutils 8.25

1 Answers1

2

The cut utility "cuts" one or several columns out of its input. Like many other Unix utilities, cut is a stream-based line-by-line reader that applies its processing to each line of input and then contiues with the next line.

You can not use \n as the delimiter for cut since that is what it expects separate the lines.

A roundabout way of creating two columns for cut to work with would be to use paste. The paste utility also reads it input line-by-line, but it buffers and outputs it into tab-delimited columns according to the specification that you give it.

In this case:

$ mycommand | paste - -
192     250

Then with cut added:

$ mycommand | paste - - | cut -f1
192
Kusalananda
  • 333,661