P
P
PapiRUS902021-06-16 11:35:51
bash
PapiRUS90, 2021-06-16 11:35:51

How to execute the abc command and redirect the output of the error stream to the file error.txt, as well as display the error stream on the screen without empty lines?

The output of errors to a file is understandable:
abc | abc 2>error.txt
But I can’t figure out how to make the output in the terminal without empty lines.
Tried
sed '${/^$/d;}'and grep -v '^$'
doesn't work.
Please help, it is advisable to poke where to read (except for man in bourgeois: ()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xibir, 2021-06-16
@xibir

Output without blank lines
abc | sed '/^$/d'

S
Saboteur, 2021-06-16
@saboteur_kiev

echo -e "hello\nworld\n\n and me" 2>/dev/null | grep -v '^$'

Your solution should work, just put the redirects in the right order

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question