All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

Can't seem to concatenate multiple files in different directories

I'm trying to concatenate multiple files together that are in different directories using the following command: ~$ find . -name ‘*.text’ -exec cat {} >> combined.text \; However it doesn't ...
0
votes
1answer
130 views

Pipe file containing list of images to sxiv and reflect changes immediadly

Suppose I have a file images.txt which contains for example image1.jpg image2.jpg image3.jpg Then I pipe the images.txt to sxiv and I want that the thumbnail view reflects the changes immediately. ...
1
vote
3answers
6k views

write multiple lines to a file in one line command [closed]

I have a file that i want to create using command line, using the cat tool (or something similar). The text in question is multi line and is in a certain format (yaml) - which i want to maintain. Is ...
1
vote
1answer
1k views

How to display trailing whitespaces in the text file?

I'd like to be able to print and see the trailing whitespaces in the text file (just display, not remove). I've tried with cat -v which suppose to display non-printing characters, but it doesn't ...
-5
votes
2answers
412 views

How does this `cat` command to txt script file work?

Suppose we have a txt file file.txt with each line is a python script e.g. python a1.py python a2.py python a3.py What does the following command is really doing ? cat file.txt | xargs -n 1 -P $...
2
votes
1answer
5k views

Is cat the only reliable command that can read data from serial?

I have a scale that continuously send data via serial port, 2 times per second. The only reliable way on reading this data happened to be cat command. The following works: cat /dev/ttyUSB0 But the ...
0
votes
2answers
135 views

cat file : prints prior to “user :/” prompt

file contains just 1 line: aaa when I run "cat file" it mixes to username user /dir : cat file aaauser /dir : What could be the problem ? Extra Info: perhaps this is not properly set in bashrc ? ...
22
votes
2answers
2k views

cat gives different error when opening non-existing file

Both of the following commands try to open a non-existing file foo, but the error messages are a little different. What could be the reason? $ cat foo cat: cannot open foo $ cat < foo -bash: foo: ...
4
votes
3answers
534 views

Difference in cat sth vs cat < sth [duplicate]

I realized that cat sth and cat < sth both happen to give same output. Are they the same?
2
votes
2answers
1k views

Does the cat command pass back a file or the contents of the file?

Compare the following commands: cat f.txt | grep "someText" grep "someText" f.txt They both seem to work. But the documentation for cat says cat outputs the contents of the file rather than the ...
2
votes
3answers
3k views

Why 'cat' can't read content of pdf files?

When tried the command cat < 1.pdf it printed a very large output, which was totally incomprehensible to me. The content of 1.pdf was abc. The output was like this: ÀýÓëöûcÎ=ÉÐÎTaüÍ8]ö¹mg:=Rú*@...
-4
votes
1answer
290 views

What does “|” between arguments in cat command do?

I understand what the "cat" command does. I.e. cat file1 file2 > file3 Will put the contents of file1 and file2 in file3. (If I am not mistaken) But what exactly does: cat file1 | file2 > ...
0
votes
1answer
557 views

What is the logic behind the expression cat > foo << “wordofchoice” [duplicate]

I know the > and >> operators, > puts something into a file by deleting the old content, >> appends something onto the end of the file's content. When I only use cat > foo I am able to write ...
21
votes
2answers
24k views

Ctrl+D for ending terminal line input

If I do $ cat > file.txt textCtrl-DCtrl-D Question 1: If I don't press enter, why do I have to press Ctrl-D twice? If I do $ cat > file.txt pa bam pshhhCtrl-Z [2]+ Stopped ...
3
votes
1answer
201 views

How to set default tabs only for cat?

I prefer to set tabs 4 however this may have some side effects, such as for example ls out put may look not properly aligned. How might I configure the terminal / cat to use four spaces for tabs for ...
3
votes
2answers
6k views

“cat” command: how to automatically escape everything that might be a violation?

If you copy the contents of httpd.conf and then paste it into a cat command.. such as this one.. #!/bin/bash cat > /test << EOF pasted here.. EOF you run into this error: -bash: command ...
4
votes
1answer
3k views

How can I get less or cat to use color in the output from .cat of my .bashrc, similar to vi 'ing it?

When I vi my .bashrc file it is colorized, i.e. but when I cat or less the file I get all white, i.e. How can I get cat (and less) to have color? cat does have color for my ruby .rb files but not ...
20
votes
2answers
62k views

How can I concatenate all files in a directory together in one command line operation? [duplicate]

I have 1000 csv files in a directory. I would like to concatenate them all together in order. They are named img_size_1.csv to approx img_size_1000.csv This answer is close but assumes a list file. ...
4
votes
1answer
10k views

cat file to multicast

I have a text file (test.txt) which represents captured network data. The actual protocol is text-based, with NULL line endings, so this isn't a problem. I need to run this test captured data ...
2
votes
3answers
11k views

Can't cat a file or make a directory: contradictory output?

I am getting output from a terminal in Ubuntu 12 that I don't understand. $cat sublime no such file or directory $mkdir sublime cannot create directory 'sublime': File exists How can both of these ...
122
votes
8answers
664k views

How can I display the contents of a text file on the command line?

I would like to display the contents of a text file on the command line. The file only contains 5-6 characters. Is there an easy way to do this?
2
votes
3answers
2k views

Trying to send HTML mail on mac OSX Mountain Lion

I'm trying to send email with an html file as the body (it's actually a cucumber results report if that matters) or an attachment (if sending it as the body does not work) via the command line I've ...
1
vote
4answers
557 views

concatenating multiple files with multiple headers

Im trying to concatenate multiple files with multiple headers to have one file with all the information in it for example. File 1: Numbers 1 2 3 Letters A B C File 2: Numbers 4 5 6 Letters D E F ...
17
votes
1answer
2k views

Make program first read from pipe, then from keyboard

Consider the interactive program interactive. I have to run this program fairly frequently, and each time I run it the first few commands are the same. Obviously, having to type those commands over ...
62
votes
6answers
65k views

Is there a simple command for outputting tab-delimited columns?

E.g. I have a file (produced with echo -e "var1\tvar2\t\var3\tvar4" > foo) that are output as: $ cat foo case elems meshing nlsys uniform 2350 0.076662 2.78 non-conformal 348 ...
7
votes
4answers
50k views

How to pause listing long text file with cat in command prompt after 10lines then press any key

How to pause listing long text file with cat in command prompt after 10lines then press any key. for example: cat myfiles.txt bla bla bla bla bla bla . . . bla press enter to continue
27
votes
12answers
43k views

How can I “cat” a file and remove commented lines?

I'd like to know if there is a way that I could cat file like php.ini and remove all lines starting with ; For example, if the file contained this: ; - Show all errors, except for notices ; ;...
6
votes
5answers
670 views

Conflict between my prompt definition and cat in zsh

I have a file on a remote filesystem that I know has a short text string in it (a sequence of numbers in a single line). If I open the file on a text editor like nano or Emacs I can see the string. ...
42
votes
4answers
12k views

How can I display syntax highlighting on a file?

Is there a variant of cat that outputs syntax-highlighted lines of code when used on a source file? An idea: maybe vi[m] or another editor can be asked to dump the syntax-highlighted contents of said ...
11
votes
2answers
3k views

Performance difference between stdin and command line argument

For some commands, it is possible to specify certain input as either stdin or a command line argument. Specifically, suppose command can take stdin input and a filename as command line argument, and ...