Pipes or named pipes are a feature of the POSIX standard that allow separate processes to communicate with each other without having been designed explicitly to work together.
0
votes
1answer
29 views
redirect awk information to stdout
I am trying to gather information for CPU use for all the processors in a text file.
mpstat -P ALL -u 1 | awk '{print $4}' > cpu.txt
&&
mptat -P ALL -u 1 | awk '{print $4}' | tee cpu.txt
...
1
vote
1answer
51 views
Flushing a named pipe
I am using the following to redirect output from my script to both terminal and log file while appending date to every line that goes to the log file:
NPIPE=/tmp/$$_$RANDOM.tmp
mknod $NPIPE p
tee ...
-2
votes
2answers
75 views
When did the windows command line get the pipe (|)? [closed]
I freely admit I have very little experience with the Windows cli but I seem to recall that DOS had no pipe (or redirect for that matter, but I may well be wrong, its been a while).
I have seen some ...
3
votes
3answers
84 views
How to pipe data over tcp from the command line?
I would like to pipe data from one machine in the command line to another machine over tcp. I guess I could write a socket server but this must already be implemented. For example I could use it to xz ...
1
vote
1answer
71 views
grep with colored output returns several empty lines
I have strange issue with grep (2.12-2, debian testing).
In some situations when I do something like this:
grep -rni '."spacer">.' . grep return me several empty lines:
If I add --color=none ...
1
vote
1answer
54 views
Shell script detecting errors from command called by script
I am calling applications from my shell script, which performs a number of important steps in sequence, one step being below:
for database in $(
echo 'show databases;' |
mysql ...
1
vote
2answers
67 views
Finding folders only
My harddrive is in a mess, so I decided to do a cleanup. As a part of this, I want to merge all folders containing music into one. What I want to do is, look for any *.mp3's and *.aac's on my drive ...
0
votes
2answers
55 views
Dynamic terminal title: show server load status at X second interval
When I have a bunch of terminals open in my WM it would be nice if terminal window titles reflected current user and host (easy) along with dynamic server load details, updated at some interval ...
5
votes
1answer
233 views
Pipe not working in cmd.exe on Windows 7
I have started seeing some very strange issues with the pipe command not working on Windows 7 64-bit on my machine. Commands like this:
echo test | more
used to work without a problem, but now ...
0
votes
1answer
66 views
Reading the same stdin with two commands in bash
I would like to pipe an output of to two separate commands <2,3> in bash. What is the best way of doing this? At the moment, I have following script:
command source > output
command2 output ...
0
votes
2answers
77 views
Windows Vista piping dir output into attrib command
I had a virus or something on my computer that set the attributes for all the folders in the root of my external drive to system and hidden, and created shortcuts to them. I am now trying to remove ...
1
vote
1answer
89 views
Alias defined in .bashrc not working after pipe
I'm stuck with the following problem.
I've defined an alias in .bashrc (and .bash_profile):
alias echo2="echo"
This works well:
$ echo2 "test"
test
However, if I try to use it after a redirect, ...
1
vote
1answer
180 views
How to redirect multiple bash commands to a variable AND screen?
I would like to capture a subshell's output in a variable and print it in the terminal screen simultaneously. Is it possible to do this by assigning the subshell to a variable and piping stdout and ...
0
votes
1answer
90 views
piping output from curl to rpm2cpio
I download alot of srpms to rummage through, I used to go through a long winded approach,
root@server$ curl rpm -o file.rpm
root@server$ rpm2cpio file.rpm | cpio -id
but that leaves behind an ugly ...
4
votes
3answers
76 views
Transparent usage of temporary files as means of piping
As many of us are surely aware, it's always a good idea to make your program accept stdin input. Very many programs do allow that *nix environments. This lets us do cool things like piping
echo "foo" ...
5
votes
1answer
83 views
cat-ing a file to a unix pipe causes Matlab to freeze
I've created a named pipe on Debian using mkfifo pipe.in. I want to write to this pipe from Matlab.
To do this, I use the following matlab command:
unix( 'cat <myfile> > pipe.in' )
...
2
votes
3answers
84 views
How do I make a bash alias that outputs file names in a format I can pipe to vim?
When rebasing with git, I'm interested to open the files that have merge conflicts.
I can do this with:
vi `git diff --name-status --diff-filter=U | awk '{print $2}'`
but if I alias that:
alias ...
0
votes
0answers
83 views
Rendering HTML from a pipe
I would like to be able to generate HTML then pipe it to a program which will render it, something like this:
for i in 1 2 3
do
for j in a b c
do
echo "<table ...
3
votes
1answer
112 views
Redirect stdout to multiple programs
I'm doing some stream processing of some quite substantial files-- I was wondering if there was a way to split stdout in order to pipe to multiple programs. What I'd like to do is something like this: ...
0
votes
0answers
44 views
gunzip piped to dd - performance is slow
Given the following command:
gunzip -c /mnt/mysmbshare/mybackup.gz | dd of=/dev/sdb bs=1M
Why would the machine go through cycles of a really long phase of reading data from the network (with no ...
2
votes
2answers
52 views
use pipe inside a find exec statement
I'm trying to find which jar contain a class, I wrote the below, which doesn't seem to work
any ideas?
find -type f -name "*.jar" -exec jar -tvf "{}" \| grep MyClass \; -ls
0
votes
2answers
157 views
Setting pipefail for a single piped command
I need to execute a number of piped shell commands from a non-BASH script (namely PHP script) like these:
command1 | command2 | command3
so that, if command1 fails with a non-zero exit code, each ...
4
votes
5answers
244 views
How do I pipe a list of numbers straight from the shell into a command?
How do I pipe a list of numbers straight from the shell into a command? For exampe something like this
[1,2,3,4] | sort
would give
1
2
3
4
EDIT:
In response to the answers kindly posted so ...
3
votes
2answers
73 views
Mutual piping on linux
I would like the output of A to be input for B and at the same time the output of B to be the input for A, is that possible?
I tried the naïve thing: creating named pipes for A (pipeA) and B (pipeB) ...
0
votes
2answers
98 views
Why cat $(find /usr/portage -name *.ebuild) | grep RESTRICT - works? And find | grep - not?
Why I can't grep find? Only helps grepping cat of find.
As I see program grep could see some context in which every command runs. But it's counterintuitive for a newbie like me. When given with ...
0
votes
1answer
90 views
linux: access mounted volumes as normal folders/files
I have a closed source software (client) running on a linux machine (debian) to deliver files to a backup machine.
This works fine except this client software does not access the mounted volumes ...
0
votes
2answers
137 views
Linux output redirection not working with awk
I'm trying to write a nice csv-file based on some output from top. I reformat the output with awk like this:
top -b | nawk '/Cpu/ || /Tasks/ { if($1 ~ /Cpu/) { printf "%s,",$3 } else { printf "\n" } ...
2
votes
1answer
54 views
.cmd script output only goes to pipe occasionally
I'm having a problem with a .cmd script only occasionally passing it's output through a pipe. The script is auto generated by npm and it runs jshint using node. Here's the script:
:: Created by npm, ...
2
votes
2answers
243 views
Piping bash output to perl script's arguments
I have the following bash command:
find repo -name '*.c'
What I want to do is use the files returned as arguments to my perl script, so that it's equivalent to running:
perl ./myscript file1.c ...
4
votes
1answer
62 views
Launch only the command if the previous one worked inside SSH, shell
I've got a SHELL script which is using a pipe to separate my two commands:
ssh -oBatchMode=yes user@hostname "mysql -u yop -pyop -c yop | echo test"
The problem is even if my connection to MySQL ...
0
votes
1answer
430 views
How do I unzip a compressed file as it's downloading?
I'm downloading a large file that's not an archive, and I want to combine the tasks of downloading and decompressing.
How can I do them simultaneously?
0
votes
2answers
64 views
With regards to piping commands, what are the greater than (>) and less than (<) symbols called?
On linux at least, and I think windows/dos shell too you can use > to "pipe" output into a file. Something like:
cat myfile.txt > mightAsWellCP.txt
What is that piece of syntax sugar called? ...
2
votes
1answer
356 views
Unix bidirectional pipe on commandline
I've been able to use this linux command to connect Netcat to a serial port:
nc -l 80 <> /dev/ttyS0
I would like to be able to log this transaction. My backup plan is to use Wireshark to ...
3
votes
2answers
145 views
How can I run several parallel shell jobs and monitor all of them at once?
I have a large number of large files (hundreds of files, hundreds of MB each) which I need to pipe through a number of programs to filter and convert them. I'm taking advantage of multiple CPU cores ...
0
votes
2answers
493 views
pipe: too many files open renders entire OS completely useless
I'm running Ubuntu 12.04, and I am having a major problem. Two separate times today, one of my open gnome-terminal sessions locked up and printed the error
pipe: too many open files
I realize ...
0
votes
1answer
168 views
Transcode moviefile to h264/aac with ffmpeg for video and neroacenc for audio
I'm on Mac OS 10.8.1, with ffmpeg-devel installed as a macport. I can run NeroAacEnc(win32) via Wine. I can transcode a movie into h264/aac using a simple ffmpeg command:
ffmpeg -i INPUT.MP4 -vcodec ...
2
votes
3answers
328 views
count files in a list of directories
I have file with a list of directories that I would like to know how many files are in each directory.
.../images/idsuffix/userids/
This will give me the count of files and directories for ...
3
votes
1answer
2k views
What are reasons for local Windows named-pipes to fail?
I've been working hard on this one all day and I'm stuck. This morning our asian collegues called me because a SolidWorks addin for our product data management system could not communicate with the ...
2
votes
1answer
201 views
Can I use pipe output as a shell script argument?
Suppose I have a bash shell script called Myscript.sh that need on argument as input.
But I want the content of the text file called text.txt to be that argument.
I have tried this but it does not ...
1
vote
1answer
2k views
How to connect to Ubuntu using Serial Port?
I am using VMware and I want to connect to Ubuntu VMs via serial port. I am connecting both using pipe as referred in this website https://www.vmware.com/support/ws3/doc/ws32_devices3.html
How do I ...
1
vote
2answers
840 views
Silence curl with >/dev/null 2>&1 when it's piped
So I have a curl that is piped to a grep and a sed.
Where would I apply the >/dev/null 2>&1 ?
curl www.site.com | grep stuff | sed "other stuff"
At the very end or after the curl?
5
votes
1answer
240 views
Locked out of host after reaching some ulimit
So, I have a sudoer account in a remote host, in which I create a process with thousands of threads and sockets. The thing is, if I create too many threads/sockets (not sure which one, it might even ...
2
votes
1answer
133 views
Do people use dbus, pipes or ports usually for interprocess communication? [closed]
It's hard to find dbus libraries for the programming languages I've been using though the idea looks neat. Sockets are the most supported way but it also eats one of my computers ports and then I also ...
1
vote
2answers
159 views
Bash: Concatenating TAR balls
Is it valid to do this:
{
tar -c dir1
tar -c dir2
} | cat > file.tar
Is the resulting file.tar a valid tar ball?
If not, how can I concatenate tar balls on the fly?
0
votes
1answer
129 views
Pipe multiple commands to single grep
I'd like pipe the output of multiple commands to a single grep.
Example:
I'd like to combine these two lines:
smartctl -A /dev/sda | grep -e Reallocated_Event_Count -e Current_Pending_Sector
...
1
vote
1answer
68 views
Why Does Issuing One lsof Launches Two Processes?
I'm on current OS X 10.7. Sometimes I want to check which application locks a certain file. I do that by
lsof | grep $FILENAME
I noticed that running this command invokes two instances of lsof. Why ...
2
votes
2answers
4k views
In windows, can I redirect stdout to a (named) pipe in command line?
Is there a way to redirect the standard output of a process in Win32 console to a named pipe?
Named pipes are built in to Windows and while they would be an useful concept, I've never seen them used ...
3
votes
2answers
197 views
How can I retain grep's match highlighting when piping find into grep?
If I run grep foo bar.txt, grep highlights each occurrence of "foo" in bar.txt. But sometimes I want to use find to determine which files grep searches. So I do something like this:
find . -iname ...
2
votes
1answer
501 views
multiple png images over a single pipe to ffmpeg (no file writes to disk!)
I have a program that generates a script for gnuplot, which in turn generates a lot of png images and send it to stdout. I want to pipe these images to ffmpeg without writing them to the disk. This is ...
3
votes
3answers
649 views
How to get both PIPESTATUS and output in bash script
I'm trying to get last modification date of a file with this command
TM_LOCAL=`ls -l --time-style=long-iso ~/.vimrc | awk '{ print $6" "$7 }'`
TM_LOCAL has value like "2012-05-16 23:18" after ...
