Linked Questions

0
votes
2answers
1k views

How to grep stderr? [duplicate]

How do I grep this command that includes a wildcard? How do I grep stderr? The grep does not seem to do anything: $ less /Users/raine/.nvm/versions/node/v5.5.0/lib/node_modules/* | grep "Not a file"...
67
votes
7answers
36k views

When would you use an additional file descriptor?

I know you can create a file descriptor and redirect output to it. e.g. exec 3<> /tmp/foo # open fd 3. echo a >&3 # write to it exec 3>&- # close fd 3. But you can do the same ...
24
votes
3answers
4k views

Order of redirections

I don't quite understand how the computer reads this command. cat file1 file2 1> file.txt 2>&1 If I understand, 2>&1 simply redirect Standard Error to Standard Output. By that ...
21
votes
3answers
15k views

Piping STDERR vs. STDOUT

According to "Linux: The Complete Reference 6th Edition" (pg. 44), you can pipe only STDERR using the |& redirection symbols. I've written a pretty simple script to test this: #!/bin/bash echo "...
3
votes
3answers
2k views

Please help explain this bash output redirection

This script was posted as answer to a Question. And I'm trying to work out what's going on. result=$( { { ssh host app-status >&3 3>&-; echo "$?" } | { until read -...
1
vote
1answer
1k views

How to extract certain data from an MQTT stream

I type mosquitto_sub -d -t +/# from the Ubuntu terminal to access the MQTT stream. However I would like to see only a specific set of data from the MQTT stream. I've added | grep -v PING so ...
4
votes
2answers
723 views

How does file descriptor re-assigment work?

In a way this question is a extension of another question. In bash you can do pretty neat stuff with file descriptors. Like { command > /dev/null } 2>&1 | grep filter; to grep on stderr ...
3
votes
1answer
945 views

How to grep XRDP version number?

Not able to grep xrdp version line by running below command on ubuntu 14.04 $ sudo xrdp -v | grep -i "version" Output : Blank $ sudo xrdp -v Output : logging configuration: LogFile: /...
0
votes
1answer
173 views

Filtering standard error output from remote BorgBackup repository

I want to filter standard error for a command that prints status information to standard error. In this case, Borg Backup. Specifically, the default output of borg check includes lines like: Checking ...
0
votes
2answers
43 views

Swapping STD{OUT,ERR} in a pipeline multiple times

Based on this answer, I wrote the following which swaps file descriptors 1 and 2: swap12: #!/bin/bash "$@" 3>&1 1>&2 2>&3 3>&- I can then operate on STDERR in a ...