Skip to content
Advertisement

Tag: stdout

Filter followed tail to file using grep and redirect

I want to get the output of tail -f /var/log/apache2/error.log | grep “trace1” into a file. But tail -f /var/log/apache2/error.log | grep “trace1” > output.txt does not work, while the first command gives an output in my terminal window as expected. I guess it has to do with the follow-parameter, because if I omit the “-f”, the output file is

Why does read block on a pipe until the write end is closed?

I’m trying to bolster my understanding of things related to fork, exec, dup, and redirecting stdin/stdout/stderr by writing the following popen-type function: Compilation and execution: My question is about the read() – I don’t quite grok why does the read() is seemingly block until the child process has completed (thereby closing its end of the pipe)? Is it coincidence? You

How to view stdout in AWS environment?

Below is the lambda function: executed with NodeJS runtime ( as serverless app) that writes the incoming event record to stdout By definition, console.log prints to stdout, as mentioned here, but I need to go through cloud watch logs, as this is AWS serverless app: What is the correct way to view stdout in AWS environment? Answer Lambda function is

Shell script: Redirect output of program to changing files

My goal: I would like to redirect the stdout output of my program foo to a changing output file depending on the running time of the program. The program foo itself is listening on a bsd socket for arriving packets and displays information contained in them. So essentially, after running the program foo for 10 minutes, I would like to

Using unbuffered pipe as “dummy” file output

I’ve been dealing with a weird issue that I can’t find a way to solve. My situation is as follows. I have an application in python called “app1”, that requires a file for outputting the results of it’s execution. I have a secondary application, called “app2”; a binary, that gets the input from stdin. I want to pipe what “app1”

how to output only when command finish

I’m running multiple commands using &: This doesn’t work well because the output lines are interleaved. I want each curl to hold its output, until it’s done. How to do that? I understand I can use temp files, concat together and delete afterwards. Are there better ways? Answer You could execute each curl inside a subshell: 2>&1 redirects stderr to

Why cat 0>file doesn’t work

In Unix, I know that 0 1 and 2 represent stdin stdout and stderr. As my understanding, the command cat meaning “concatenate” can concatenate different files. For example, cat file>&1 can concatenate the file and the stdout and the arrow means the redirection from the fileto the stdout, so we can see the content of the file from the terminal

Logstash not producing output

I have just installed logstash 1.5.3 on a Linux machine. Details: When I try to run the basic “hello world” setup I get nothing on stdout. Any ideas why? I installed this on my Windows machine and am able to run it there. Output to file is also not working: The file “logtest1” is not even being created. Answer The

Advertisement