New answers tagged

0 votes

check md5sum from pipe

Bringing up a very old question here, but I had the same question. In my case, I was wanting to verify MD5Sums on some *.gz files I retrieved (via SFTP) over a relatively slow internet link. The key ...
user avatar
3 votes

why i need to run pipe(2) so i can share data between processes?

Let's assume the usual situation of a shell running on a terminal. All of stdin, stdout, stderr of the shell are connected to that terminal, and reading from one reads input from the user, and writing ...
user avatar
  • 116k
0 votes

Is there any way to exit “less” follow mode without stopping other processes in pipe?

CtrlZ and fg to background and foreground again also serves as a way to get back into control mode.
user avatar
1 vote

why i need to run pipe(2) so i can share data between processes?

Let's suppose you don't use a pipe. Your first process can write to stdout. Your second process can read from stdin. It's easy enough to close stdin of the second process, but then what do you open to ...
user avatar
  • 90.2k
8 votes

Why is using "|" or "&" provide different sizes of the result file?

Some of the details in this answer assume that the user uses a shell other than zsh. The details differ slightly for the zsh shell due to its MULTIOS feature. strings *.bin > bin.txt | sort -n bin....
user avatar
  • 271k
3 votes

What is the difference in how linux implements commands which accept input via pipe vs. command arguments?

Why would a command accept input via one method but not the other, Ultimately, because the programs were made that way. More practically, programs tend to accept input in the way that makes most ...
user avatar
  • 116k
3 votes

What is the difference in how linux implements commands which accept input via pipe vs. command arguments?

However, it is not obvious to me the fundamental difference between the implementation of commands that can receive input via pipes and those that can only accept command arguments. Well, whether to ...
user avatar
-1 votes

remove most but not all lines containing carriage return (\r)

Here's a fringe way to do it in awk : {m,g}awk '((+$_ % 3) % NF)~(!_<NF)' FS='\r$' # yes that's a # tilde ~ not a minus - 1 2 3 4 5 6 7 8 9 10 1^M 4^...
user avatar
1 vote

Cut off pipe after N bytes

Several implementations of head support a -c option for that. The GNU implementation also accepts suffixes, M for mebibytes, recent versions also supporting MB for megabyte (1,000,000) and MiB for ...
user avatar
0 votes

Using a pipe with extra arguments at the end. Correctly directing the pipe instruction with multiple arguments

The solution was simpler than I expected: To do this: command1 -flag target.file | command2 -flag PIPEOUTPUT1HERE argument2 I used simply- to direct properly the output of the first command: command1 ...
user avatar
0 votes

How to redirect a list of human readable paths to another command?

Leaving command substitutions ($(...) or the `...` archaic form) unquoted invokes split+glob (split only in zsh) in Bourne-like shells. The splitting is done on characters of the $IFS special ...
user avatar
0 votes

How to redirect a list of human readable paths to another command?

If you want/need to pass the same line to multiple commands, something like this would work: #!/usr/bin/env bash T="${IFS}" # Save off the Internal Field Separator IFS=$'\n' # Set it to ...
user avatar
  • 606
2 votes
Accepted

Dealing with different prototypes of pipe()

The pipe man page you found has two different purposes: It documents the system call interface used by the Linux kernel. It documents the system call wrappers provided by the GNU C library on Linux. ...
user avatar
1 vote

Dealing with different prototypes of pipe()

If I want to be as cross-platform as possible, do I now have to write code that compiles when it is given either prototype? No, there's no need here. You're looking at the section 2 manpage entry, ...
user avatar
  • 2,576
0 votes

remove most but not all lines containing carriage return (\r)

Using GNU sed, we use the hold space for counting. sed -E ' /\r$/{ G;/\n$/P s/.*\n/./ /.{3}/z;x;d } ' file Using awk, we Use the variable c as a circular counter that gets reset ...
user avatar
  • 5,398
1 vote
Accepted

remove most but not all lines containing carriage return (\r)

$ awk '!(/\r$/ && ((++c)%3 != 1))' file | cat -v 1 2 3 4 5 6 7 8 9 10 1^M 4^M 7^M 10^M 1 2 3 4 5 6 7 8 9 10 Original answer: Sounds like all you need is this, using any awk: awk -v RS='\r' '{...
user avatar
  • 22.5k
7 votes
Accepted

feed output of command to another command as file

What you're looking for is called process substitution; it's not a standard feature of the shell, but supported in Bash/ksh/zsh. An example: $ echo <(echo foo) /dev/fd/63 $ cat <(echo foo) foo ...
user avatar
  • 116k

Top 50 recent answers are included