Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
395 views

Why pipes not working for cat | cat | ls?

I really need help and any suggestions will be very welcomed. Me and a mate have coded a mini version of the Shell and I did parsing and executing parts. All is working properly except for some cases ...
bl000m's user avatar
  • 15
0 votes
1 answer
56 views

bash cat pipe supposedly misbehaving

In the following, I have made echo to write to stderr; then it's piped to cat, which has both output streams connected to /dev/null. $ echo something 1>&2 | cat 2>&1 >/dev/null ...
Ankur's user avatar
  • 149
1 vote
1 answer
152 views

An error occurred while processing STDERR using the pipe

My working directory is as follows: MyWorkDirectory └── test The file "test" contains a line of information: 1:2:3:4:5 When I use the following command: cat test foo the output is as ...
jinpeng.s's user avatar
0 votes
2 answers
34 views

Unix concatenation commands

I've got a question here that I dont understand: cat abc.dat | tee bcd.dat | tr ab ba > cde.dat In this instance, I understand the translate part, but I’m a little confused as to what the pipe | ...
dl784's user avatar
  • 61
0 votes
1 answer
45 views

Why does a *.sh script executed on a remote machine sometimes return only partial output?

I run a command cat getStorage.sh | ssh -T remoteHost >> storageLog.csv. getStorage.sh looks like this: #! /bin/bash dateTime=$(date) echo -n $dateTime, df -h /directory/ | tail -n 1 | awk '{ ...
IslandPatrol's user avatar
0 votes
2 answers
1k views

How to slow down the cat command without piping the output to the more command? [closed]

Bash version 4.4.0 Ubuntu 18.04.5 LTS Is there a way to slow down the cat command to a crawl so I can visually see the output of a file without piping the output into the more command or another file?
Vituvo's user avatar
  • 1,048
0 votes
1 answer
554 views

Reading data from standard input using two threads

I am trying to read data from standard input (stdin) using two threads but I'm not able to read data properly. I tried on Linux platform using gcc compiler. I am trying to read data using cat command ...
msc's user avatar
  • 34.5k
0 votes
0 answers
382 views

Use pipes to change the input entered using cat command in child process in C

I have an operating systems problem where I need to execute the 'cat' command in the child process. The child process is created using fork() system call. While running 'cat' command in the terminal, ...
Ramanpreet Kaur's user avatar
5 votes
3 answers
4k views

how to pipe ls into cat with xargs so that filenames are listed?

For using cat to output *.txt files within a specific directory, how can I insert the filename as a "break" before each file? file #1 contents of file file #2 contents of file ideally as ...
Thufir's user avatar
  • 8,476
0 votes
1 answer
969 views

tcsh passing a variable inside a shell script

I've defined a variable inside a shell script and I want to use it. For some reason, I cannot pass it into to command line that I need it in. Here's my script which fails at the last lines #! /usr//...
ZakS's user avatar
  • 1,131
0 votes
1 answer
766 views

Create a file with the content of 2 other files, then sort the new file

I am using the following command: cat < file1.txt | tee >> unsorted.txt | cat < file2.txt >> unsorted.txt | sort -r unsorted.txt > sorted.txt If i run this line once i get an ...
Portgas  D Ace's user avatar
0 votes
1 answer
633 views

How to find file and print the content of the file by using find and cat (is it possible?)

so I am fairly new at working with Linux and i was wondering if there is any way to use find commando to find a file in a location then pipeline it to print out (with cat commando) the content of that ...
Tavy's user avatar
  • 1
-1 votes
1 answer
274 views

Linux print file and use it in for example a curl request

This might be a complete noob question, but I would like to know a simple oneliner to solve my problem. Imagine following: I have 5 files, could be .txt, .sql .anything. root@DESKTOP:/$ ls test.sql ...
sdev95's user avatar
  • 142
2 votes
1 answer
387 views

Can I make a shell function in as a pipeline conditionally "disappear", without using cat?

I have a bash script that produces some text from a pipe of commands. Based on a command line option I want to do some validation on the output. For a contrived example... CHECK_OUTPUT=$1 ... ...
jozxyqk's user avatar
  • 17.2k
0 votes
1 answer
231 views

create a file using Cat in terminal and pass the file to another command

I have CLI command which works great when the file is created somewhere outside and the filename input is given to the command. For eg: mycli create rr --filename ./example/rule.yaml (works perfectly) ...
zubug55's user avatar
  • 729
0 votes
1 answer
892 views

How to use grep with curl for lots of urls and return $url

After a lot of cutting and filtering i got a list of urls, in a text file.. i want to pass these urls to a curl command to curl all the urls in the text file and at the same time, grep the output of ...
cherryblossom's user avatar
0 votes
1 answer
261 views

Executing cat|grep|grep using 2 pipes

Title is self-explanatory on what I want to do so here is my current code: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/wait.h> int main() { ...
Sergio's user avatar
  • 275
0 votes
3 answers
1k views

Piping into grep using cat returns error: no such file or directory

I am practicing on bash. When I try this command, I get an error: "grep: where: No such file or directory". cat file2.txt | tr " " "\n" | grep –i where | wc -l Content of file2.txt = 1 2 3 4 where 5 ...
prony's user avatar
  • 75
1 vote
0 answers
37 views

Debugging fails when reading input from file [duplicate]

pdb exits with a BdbQuit exception when I try to use it within my script main.py which is run as follows: cat input_file.txt | python main.py You can reproduce the error using the following example: ...
Stoufa's user avatar
  • 21
3 votes
1 answer
8k views

Pipe Command Output into Awk

I want to pipe the output of a command into awk. I want to add that number to every row of a new column in an existing .txt file. The new column should be at the end, and won't necessarily be column ...
JVGen's user avatar
  • 571
1 vote
2 answers
57 views

Command to replace string in one file with content of another file

The file /var/cpanel/mainip contains the main IP of my server and nothing else. The file /etc/csf/csf.blocklists contains a list of firewall blocklists, and part of the file contains a line with an ...
Peter's user avatar
  • 23
0 votes
3 answers
319 views

Overriding file in bash in one pipe

The result of cat file1 | cat > file1 is empty file1. The result of head file1 | cat > file1 is empty file1 as well. Of course, a real pipe is intended to have more steps - tools and ...
Sławomir Lenart's user avatar
2 votes
2 answers
3k views

Pipe cat/grep/arguments into variable in bash script

#!/bin/bash DATE=`date +%Y-%m-%d` HOUR=`date +%H` ORDERS_THIS_HOUR=`cat cli.log | grep $DATE $HOUR | grep -o "generated for Production" | wc -l` OUTPUT="$DATE $HOUR : $ORDERS_THIS_HOUR" echo "$OUTPUT"...
pcgben's user avatar
  • 756
5 votes
2 answers
11k views

Pipe multiple verbatim lines into command in bash

I am trying this in GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu): $ echo <<EOF | cat > 1 > 2 > 3 > EOF I would have expected three lines of output (with 1, 2, 3), but ...
rookie099's user avatar
  • 2,579
0 votes
1 answer
908 views

Piping multiple commands to bash, pipe behavior question

I have this command sequence that I'm having trouble understanding: [me@mine ~]$ (echo 'test'; cat) | bash echo $? 1 echo 'this is the new shell' this is the new shell exit [me@mine ~]$ As far as ...
user avatar
-1 votes
1 answer
47 views

Get current line of a file that is piped to a command

My goal is to figure out a PIN password for a daemon listening at port 30002. So I created a dictionary called pinlist and i pipe it to nc (netcat) localhost 30002 This is the command: cat pinlist | ...
MyWays's user avatar
  • 113
1 vote
0 answers
1k views

java Runtime.getRuntime().exec using cat and piping

I'm trying to run the following command through java to show the current wifi signal strenght : cat /proc/net/wireless | awk 'END { print $4 }' | sed 's/\.$//' In the terminal this command works ...
kloknibor's user avatar
0 votes
2 answers
263 views

Makefile on windows: unable to locate cmd.exe directory

I am facing an issue when I try to run a Makefile on windows (working with Cygwin). I have this line of code: cat command.bat | "$(cmddir)" cmddir was defined as cmddir := /C/Windows/System32/...
sharktiger's user avatar
4 votes
0 answers
896 views

Gradle 'exit' in a shell script [duplicate]

I want to build a package by Gradle (3.2.1) using a script. The script (hoge.sh) is #!/bin/sh gradle build echo "hello" ./hoge.sh works and prints "hello". However, cat hoge.sh | /bin/sh -s stops ...
kensuke1984's user avatar
1 vote
1 answer
1k views

Hadoop hdfs cat pipe edgenode to hdfs

I am trying to send data from the local edgenode to hdfs as a pipe. The purpose is to simulate data coming from an external server going through the edge node hitting a pipe and then landing it in ...
Defcon's user avatar
  • 817
2 votes
2 answers
1k views

cat multiple files and subshell

Is there a single shell command that will do the following: cp header page.html markdown page.md >> page.html cat footer >> page.html (Markdown outputs to stdout by default.) A ...
user avatar
0 votes
2 answers
160 views

How would I go about creating a flow chart representing a linux grep command?

I am currently using the Linux terminal and command: cat [filename] | grep [searchword] To search a file contents for a specific word/string, but how would i represent this command within a flow ...
Evie Stevens's user avatar
0 votes
1 answer
4k views

The use of pipping and wc -w in UNIX

I had a midterm exam and one of the questions were: what does the following command do step by step: cat file1.txt | wc | wc -w > file2 Then What would be displayed on the standard out of "cat file2"...
Jesus Mesus's user avatar
1 vote
1 answer
456 views

How to pipe virtual files?

I am using these commands to convert some files in inkscape: python dxf_input.py sample.dxf > output_ink.svg python scour.inkscape.py output_ink.svg > output.svg This method works prefectly ...
Christoph Bühler's user avatar
3 votes
0 answers
1k views

How does pipe behave in a cron job script?

I have some data in some files and I am piping the data to a filter using cat. cat /home/user/data1.bin /home/user/data2.bin | /home/user/bin/datafilter -f /home/user/output.txt When I run ...
Xofo's user avatar
  • 1,278
-2 votes
3 answers
1k views

Why is `ls hello.txt | cat` different from `cat hello.txt`? [closed]

I wonder why ls hello.txt|cat does not do the same thing as cat hello.txt? I am trying to pass the result of ls to cat, which seems to make sense, because the result of 'ls hello.txt' is hello.txt ...
zell's user avatar
  • 10.2k
0 votes
1 answer
841 views

Linux: cat to named pipe in a python script

I have a Java program that uses video from a framegrabber card. This program is launched through a python launcher.py. The easiest way to read the video stream I found, is to make Java read on a ...
Raoul's user avatar
  • 1,892
1 vote
2 answers
117 views

C++: Linux code does not work on Windows - piping data to program

I'm looking for some help piping a file (16-bit signed little endian integers raw data) from the command line to my program: cat rawdata.dat | myprogram The code works pretty well on Linux, 512 ...
fuxT's user avatar
  • 85
0 votes
3 answers
2k views

Piping filename from standard input in linux into c++

I want to be able to write a line in a terminal (as below) that takes a text file in the same directory and inputs its name into an executable file. cat fileName | executable I want to be able to ...
Onpetcow's user avatar
6 votes
2 answers
4k views

Piping a data file with cat to a C++ program

I'm looking for some help piping a file (16-bit signed little endian integers raw data) from the command line to my program: cat data.dat | myprogram Then it should convert the data to 16 bit signed ...
fuxT's user avatar
  • 85
1 vote
2 answers
1k views

Pipe Operator in Linux

As per my understanding, the pipe operator in Linux takes standard output of the one command and channelizes it to the standard input of the next command. But I have faced one anomaly. I am trying to ...
user2740885's user avatar
-2 votes
3 answers
87 views

New to using Linux

Using a pipe, sort a directory listing (i.e. list contents of directory and sort)… then pipe this output into cat and redirect the output into a file named “exercise5.7.txt”. I sorted the list ...
Kamanzi Munroe's user avatar
4 votes
1 answer
335 views

Why is piping into cat faster than not piping to cat?

I've just found out that doing find . is slower than doing find . | cat. Here's the results of doing time find . 3 times in my home directory: First: real 0m4.385s user 0m0.546s sys 0m2....
xenia's user avatar
  • 534
0 votes
1 answer
2k views

Command line tool to get binary data as String in Windows like Cat?

So I have program that transforms data by piping the string into stdin like so. cat input.mp3 | myexe except I want this commandline tool to run on Windows. type input.mp3 | myexe.exe and cat and ...
Skylion's user avatar
  • 2,752
3 votes
1 answer
3k views

Unix piping - echo and cat

I am having trouble with the following command in Unix Bash Shell: echo "This is some text" | cat dashes - dashes "dashes" is a file containing the line of text: "---------------------------------" ...
Vaderico's user avatar
  • 648
0 votes
2 answers
35 views

Trying to collect output from multiple statments

Is there a way to wrap all of this write (pun intended) no only ``` is in temp.md echo "\`\`\`" && cat temp.txt && echo "\`\`\`" > temp.md
ThomasReggi's user avatar
  • 59.2k
0 votes
2 answers
133 views

How do I cat a file piped from echo?

I would expect this to print the contents of foobar.txt: echo "~/sandbox/foobar.txt" | cat But instead it just prints to the console: ~/sandbox/foobar.txt How can I cat the file contents instead ...
Daryl's user avatar
  • 3,323
2 votes
1 answer
97 views

Difference in `< <(cat file)` and `<file` feeding loop

I saw the following example for reading a file in a bash script: while read IP; do ${IPTABLES} -I INPUT -s "${IP}" -j DROP done < <(cat "${BLACKLIST}") but I'd have thought to do the ...
Still.Tony's user avatar
  • 1,435
0 votes
1 answer
1k views

How to use a mixture of cats and pipes in subprocess

I am trying to cat the contents of a file and pipe it into the stdin of a second python script, then put the stdout of that into another file. On the command line it looks something like this: cat ...
holmeswatson's user avatar
0 votes
2 answers
59 views

how to append the text from daughter files to a single mother file and deleting headers from daughter files

During a structural simulation, I get the following response in a file.txt: constant date 03/23/2011 {BEGIN LEGEND} Entity # Title 1 ...
hamad hassan's user avatar