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
7
votes
2 answers

How to specify an ignore pattern with ack?

I'm trying to search for lines containing 'foo' but these lines must not contain 'bar'. What's a good way to search with these parameters with ack? I can do: ack "foo" | grep -v "bar" but it doesn't keep the nicely layed-out and coloured output of…
DBedrenko
  • 4,871
  • 4
  • 38
  • 73
7
votes
2 answers

Bash: Sort files from 'find' by contents

I have the line: find -maxdepth 1 -type f -iname '*key*' -not -name '*~' I want to extract the contents (which should be text) of all the files returned and pipe that into sort to be sorted alphabetically. I've tried piping the output of the above…
false_azure
  • 1,333
  • 4
  • 25
  • 46
6
votes
1 answer

crossfading a group of audio files with sox splice

I am able to join and crossfade two audio files using SoX, like so: sox file1.wav file2.wav outfile.wav splice -q `soxi -D file1.wav`,0.5 where the soxi substitution is fetching the duration of file1 and 0.5 is the length of the cross-fade. I am…
ted.strauss
  • 4,119
  • 4
  • 34
  • 57
6
votes
4 answers

Piping Input using Java using command line

public class ReadInput { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String x = null; while( (x = input.readLine()) != null ) { …
mephisto_
  • 61
  • 1
  • 1
  • 2
6
votes
1 answer

Angular Uppercase/Lowercase Pipe - Why not just use css?

Why do the uppercase/lowercase pipes exist in Angular? Any situation I can think of that they would be used for you could just use the below CSS instead: text-transform: uppercase|lowercase Any examples for using this in pipe in production where…
Tony Scialo
  • 5,457
  • 11
  • 35
  • 52
6
votes
1 answer

Running a Windows Batch File through Piping in Apache Spark

I have a requirement in which I have to run a Windows batch file using Apache Spark on multiple nodes of the Spark cluster. So is it possible to do the same using Piping concept of Apache Spark? I have before run a shell file using Piping in Spark…
Abhilash Awasthi
  • 782
  • 5
  • 22
6
votes
2 answers

Avoid "enter" when pasting xsel / xclip

This is somewhat simple, I presume, but still I cannot figure out how to do it. I have the following function defined: date +%Y-%m-%d_%H:%M | xclip -selection c which gets a timestamp and puts it into the clipboard. I mainly want to use this to…
TomCho
  • 3,204
  • 6
  • 32
  • 83
5
votes
0 answers

sys.stdout.encoding is None, how can I fix it without changing the script?

If I run a python script using piping, sys.stdout.encoding inside it becomes None and crashes it. How can I get away with it without modifying the script? I cannot modify it for some reason.
user1081596
  • 917
  • 1
  • 9
  • 16
5
votes
3 answers

"Piping" values into Bash variables

I have a Python script that outputs two numbers like so: 1.0 2.0 (that's a space in between the numbers, but it can be a \t, or whatever. I want a bash variable to save the 1.0, and another variable to save the 2.0. Is this possible? In the past,…
Amit
  • 7,688
  • 17
  • 53
  • 68
5
votes
4 answers

Using the pipe() system call

I've been trying to use the pipe() system call to create a shell that supports piping (with an arbitrary number of commands). Unfortunately, I haven't had much luck using pipe(). After spending a few days looking at various online resources, I…
Aryan Naraghi
  • 273
  • 3
  • 6
5
votes
1 answer

Python script using subprocess and xclip hangs if piped in bash

I have a python script that needs to output some values to stdin and copies another string to clipboard. I'm using the module subprocess to execute the xclip utility through Popen something like this: # clip.py import subprocess from subprocess…
mglart
  • 360
  • 3
  • 11
5
votes
2 answers

R: Using piping to pass a single argument to multiple locations in a function

I am attempting to exclusively use piping to rewrite the following code (using babynames data from babynames package: library(babynames) library(dplyr) myDF <- babynames %>% group_by(year) %>% summarise(totalBirthsPerYear = sum(n)) slice(myDF,…
user7988855
  • 95
  • 1
  • 3
5
votes
1 answer

'Continuous' C++ output of one executable as Input to another program

I am trying to pass the output generated by one executable as input into another. I have been able to send in one line at a time. The problem is when I try to send in a 'sequence of lines generated in a while loop' from Program1 to be read as input…
mystique
  • 507
  • 2
  • 9
  • 22
5
votes
2 answers

why doesn't watch work when piping the output of fortune into cowsay

cowsay is a silly linux tool for displaying a cow saying given text in the terminal. $ cowsay hello fortune is a silly linux too for displaying a "random" quote in the terminal. $ fortune Both of these commands can be repeatedly ran in the…
Andy T
  • 337
  • 1
  • 2
  • 14
5
votes
1 answer

Bash piping command output into sum loop

Getting into bash, I love it, but it seems there are lots of subtleties that end up making a big difference in functionality, and whatnot, anyway here is my question: I know this works: total=0 for i in $(grep number some.txt | cut -d " " -f 1);…
acib708
  • 1,573
  • 1
  • 13
  • 24
1 2
3
23 24