Questions tagged [piping]

This tag is appropriate for questions related to taking output from one operation and using it as input to a subsequent operation.

Questions concerning the chaining of command line calls where the output of one call is used as the input for another call should use this tag.

An example of piping would this Linux command:

grep -v bash /etc/passwd | grep -v nologin

The output from the first grep is piped into the second grep as input.

You can read more information about piping at Wikipedia.

351 questions
4
votes
0 answers

Android: Passing outputstream of top command to the inputstream of grep to achieve piping " | "similar in shells

I'm essentially trying to accomplish the same result that running the command: "top -n 1 -s cpu | grep -E 'list_of_package_names'" on a machine that supports shell features such as piping ( | ) would return. That being the rows that are returned by…
Jarvis Prestidge
  • 326
  • 1
  • 10
4
votes
5 answers

Lisp chaining functions macro

Is there a ready made lisp macro that allows chaining (piping) of functions? I couldn't find one. I'll try to explain what I mean with this example. Instead of using let* with lots of unused intermediate variables like this: (let* ((var1 (f1 x…
Marko
  • 30,263
  • 18
  • 74
  • 108
4
votes
1 answer

Pipe into raw_input() in Python

How could I have a program execute a target program, and then enter text into its stdin (such as raw_input.) For example, a target program like this one: text = raw_input("What is the text?") if text == "a": print "Correct" else: print "Not…
user2514631
  • 187
  • 1
  • 1
  • 6
4
votes
2 answers

Pipe output of python script

I'm running ./sample.py --url http://blah.com without error, though if I run ./sample.py --url http://blah.com | wc -l or similar I receive an error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u200f' in position 0: ordinal not in…
mbb
  • 3,052
  • 1
  • 27
  • 28
4
votes
2 answers

Piping error messages with grep

I have a script that fails because some files are missing. Running the script and piping it to grep $ ./adder | grep Error produces the following output: Error in : error reading all requested bytes from file…
mareks
  • 481
  • 2
  • 5
  • 13
3
votes
1 answer

Email piping with php script to collect the TO field?

I want to forward my bounced emails to a php script to deal with them. I am using. #!/usr/bin/php -q
onawire
  • 47
  • 1
  • 8
3
votes
2 answers

Piping into objects/properties/methods in PowerShell

In PowerShell, you can pipe into Cmdlets and into scripted functions. But is it possible to pipe into objects, properties, or member functions? For example, if I have a database connection object $dbCon, I want to be able to so something like…
Idan Arye
  • 12,402
  • 5
  • 49
  • 68
3
votes
1 answer

piping dplyr mutate with unknown variable name

I'm trying to use mutate from dplyr with dynamic variables names. I've found a couple of post on SO (here, here and here) which got me closer but not to a workable solution. I don't think much is missing, but I require your help for it. Here is a…
Bastien
  • 3,007
  • 20
  • 38
3
votes
1 answer

Pipe string into STDIN of command in Golang

I want to replicate the following subprocess.run function call in Golang. What would be the correct way to do it? subprocess.run(['kinit', username], input=password.encode()) So far, I've figured out how to use exec.Command to run external…
Sumit Ghosh
  • 1,033
  • 10
  • 29
3
votes
1 answer

Piping two programs together C Linux

Full disclosure, this is an assignment for my intro to computer security class. We are creating a guessing game (see questioner.c below) that asks the user for their name, and then a guess of the magic number. Upon telling the user whether their…
Black Dahlia1147
  • 243
  • 1
  • 3
  • 9
3
votes
4 answers

How to feed pipe into an inequality?

This has come up in multiple instances, and I do not know if this current instance is generalizable to the many cases where this arises for me, but I'm hoping an answer may shed some light. The simplest version of this is when I am doing some data…
Brandon
  • 1,722
  • 1
  • 19
  • 32
3
votes
2 answers

PowerShell Streaming Output

I'd like to capture some streaming output in PowerShell. For example cmd /c "echo hi && foo" This command should print hi and then bomb. I know that I can use -ErrorVariable: Invoke-Command { cmd /c "echo hi && foo" } -ErrorVariable ev however…
Jeff
  • 35,755
  • 15
  • 108
  • 220
3
votes
1 answer

Why won't this function work with a piped variable?

I created this function that parses a field for specific text and returns a custom object. Everything works fine if I use the syntax, Get-MachineUser -VMArray $PassedArray but it doesn't work if I pipe the array $PassedArray | Get-MachinesUser. I…
3
votes
2 answers

Bash's cat, while, let and pipe lead to strange scoping behavior

So here's my script : count=0 cat myfile | while read line do #some stuff... let count++ echo $count done echo $count The last echo statement output 0 instead of the number of lines in the file, although the echo statement in the while…
subb
  • 1,578
  • 1
  • 15
  • 27
3
votes
1 answer

GNU parallel not spawning jobs

After an upgrade to Debian 8.6 Jessie the GNU parallel script suddenly stopped parallelizing to more than 2 jobs with the --pipe and -L options. Before the upgrade the command: cat file_with_1064_lines.txt | parallel -L10 -j5 -k -v --pipe "wc…
artem
  • 95
  • 5