Using linux "cut" with stdin

I'm trying to pass data into a “slice”, say, cut off the first column of text. It works

$ cat test.txt | cut -d\  -f2-

Reading from stdin also works:

$ cut -d\  -f2- -
? doc/html/analysis.html
? doc/html/classxytree-members.html
<CTRL+D>

However, as soon as the channel is activated, it no longer accepts mine <CTRL+D>, and I can not signal the "end of file":

$ cut -d\  -f2- - | xargs echo

Update: This is apparently a bug in the old version of bash (3.00.15). It works in later versions (Spanish 4.0.33 and 3.2.25). It would be nice to have some workaround, although I cannot update easily.


Background: I have a script / oneliner that gives me compressed output cvs status(I know CVS ...) in the form

? filename

. , . + , cvs. :

$ cut -d\  -f2- | xargs cvs add
<paste lines>
<CTRL-D>        # <-- doesn't work

?

+3
2

$ cat | cut -d\  -f2- | xargs cvs add
<paste lines>
<CTRL-D>        # <-- doesn't work
+4

. ? ?

, , , Ctrl - D , . , , , Ctrl - D . "", Ctrl - D , .

0

Source: https://habr.com/ru/post/1731970/


All Articles