cat is a standard Unix utility used for concatenating files or printing specific file on the standard output.

learn more… | top users | synonyms

0
votes
0answers
20 views

cat: jobs_list: No such file or directory

below is my script generated by a program name "Raccoon". I need to run this script on the cluster. I have to run it with the following command: qsub script.sh The cluster generate the following ...
0
votes
1answer
20 views

apt - Command line option 'i' [from -info] is not understood in combination with the other options

I was making a shell script with that installs packages from a list. The code looks like this: apps="$(cat ./foo/bar/packages.txt)" apt install $apps But, I get the error E: Command line option ...
1
vote
0answers
55 views

dd and cat both reporting no space left on device

I have a windows 8.1 Pro laptop with a 500GB HD and a 500GB portable USB HD. I boot up my laptop with a linux live CD so that I can use dd or cat. Testing cat: cat /dev/sda > /dev/sdc cat: write ...
3
votes
3answers
203 views

Why does cating an executable keep changing the title of PuTTY?

Its usually been seen that if an executable is cated, provided that its a huge file, it keeps on changing the title of the 'PuTTYapplication until its done printing the binary to the STDOUT with those ...
-1
votes
1answer
64 views

How to cat file from output of other command?

If I do: perldoc -l WWW::Mechanize I get the following output: /usr/local/lib/perl5/site_perl/5.16.3/WWW/Mechanize.pm How can I, in one line, print to the screen the contents of the file given ...
2
votes
1answer
125 views

Sum of columns for rows containing a specific term

I'm wondering if there is any sed or awk command that can sum all columns for the rows with an identical identifier. For example, my file data.txt is set out as below, except that it contains ~1800 ...
4
votes
3answers
230 views

Difference in cat sth vs cat < sth [duplicate]

I am new in linux.I have been playing with bash commands and realized that cat sth and cat < sth both happen to give same output. Are they same? Can someone explain?
2
votes
3answers
65 views

Accessing each line in .txt file, download and rename links

Let's say I have a .txt file where I have a list of image links that I want to download. example: image.jpg image2.jpg image3.jpg I use: cat images.txt | xargs wget and it works just fine What I ...
2
votes
1answer
55 views

How to use “cat” command on “find” command's output?

I want to redirect the output of the find command to cat command so I can print the data of the given file. So for example if the output of find is /aFile/readme then the cat should be interpreted ...
1
vote
1answer
36 views

Can't terminate / suspend a background job

I am a beginner so I wanted to do a test for the Job Control Commands. So, I ran a cat command and then made it a background job using the bgcommand after stopping it with Ctrl +Z. Now I wanted ...
-2
votes
1answer
59 views

cat command appears to be adding extra $ character at the end of each line

I am trying to create a file and it looks like the vi editor is adding a $ at the end of each line. I don't know what's causing this or how to prevent vi from doing it. vi file.txt 12345 abcde cat -...
3
votes
0answers
41 views

slow file transfer through serial port with cat

I'm transferring a binary file to an embedded device using a custom AT command set. I'm running Lubuntu Linux on a virtual machine (Windows 7 host) and the virtual linux guest controls the physical ...
0
votes
1answer
35 views

Error while replacing date in a file using tr command

I want to replace date in a file with my date. For this, I am giving below command - tr '2016-05-25' '2016-06-17' < APCSE060.20160525 > TESTFILE alternatively cat APCSE060.20160525 | tr '...
1
vote
2answers
55 views

Specifying comma-separated command line parameters based on text file lines

I want to run a command like: command argument --parameter=param1,param2,param3 where param1, param2, param3 may be any number of parameters coming from a file params.txt, each on one line. I can ...
-1
votes
1answer
41 views

Why is `sudo cat /tmp/1 > file` wrong? [duplicate]

I do sudo cat /tmp/1 > /etc/udev/rules.d/69-libmtp.rules but I get bash: /etc/udev/rules.d/69-libmtp.rules: Permission denied System: Ubuntu 16.04 Linux kernel: 4.6
1
vote
0answers
25 views

Read a log file to extract various fields and count the occurance [closed]

I have a logger file like this: 2016-06-11 07:34:01.542 98459 [Thread-23-Job-parser-bolt] INFO JobLoader c.t.commerce.common.utils.APIUtils - Enrichment data updated successful for partnumber : ...
2
votes
4answers
840 views

With the Linux “cat” command, how do I show only certain lines by number

If I use cat -n text.txt to automatically number the lines, how do I then use the command to show only certain numbered lines.
0
votes
1answer
14 views

Create a file with the concatenated information of all files that start with “file_excel”, in chronological order

my system: Linux 2.6.18-406.el5 #1 SMP Fri May 1 10:37:57 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux my shell: /bin/ksh My issue: I want to create a file: data_excel with the information of the ...
0
votes
2answers
40 views

Add time from all log files using bash

I want to extract time from all of my .log files and add all of these times into a single entity. My log files are placed in nested directories. Directory structure for my log files: |-- temp-system ...
3
votes
2answers
107 views

Question about concatenation instructions

I have a semicolon-delimited csv file and a Korn shell script that do some elaboration. I'm searching to understand what these two instructions do in Korn shell: num_rec=`cat test.csv |wc -l|tr -d " "...
2
votes
1answer
111 views

How could I EOF `cat` through `netcat` without closing connection?

I have run into a problem where I have a ncat server with the command ncat -l [port] -k -c "cat > foo; cat > bar". When I connect to this server through netcat, it allows me to write to the file ...
2
votes
2answers
69 views

Safe execution of cat command without executing arbitrary code

I do this little file based on a combination of hexadecimal, that can broke cat and the terminal showing the file with cat, reset does not worked anymore, it is maybe putting cat in a kind of loop? ...
0
votes
1answer
53 views

How can I prepend a header to a file when using cat?

If I have a file called test.php and its contents are $a = "apple"; echo PHP_EOL; echo " the value of \$a is $a" . PHP_EOL; I want to cat the contents of test.php to STDOUT but I want to add a ...
2
votes
2answers
33 views

Ouput to a file and read it [duplicate]

I am trying to output the ps command to a file in /home/username/ps.txt. I want to create the file on the go, write the output of ps to it and also read the same in a single command. I tried this: ...
3
votes
3answers
110 views

Reverse sequence of a file with POSIX tools?

Is there any clean, clear-cut POSIX equivalent to tac? Readability as well as succinctness should both be considered.
13
votes
4answers
817 views

dd: multiple input files

I need to concatenate chunks from two files: if I needed concatenate whole files, I could simply do cat file1 file2 > output But I need to skip first 1MB from the first file, and I only want ...
0
votes
0answers
51 views

cat tty freezes the system while I can observe tty through screen

So I have been subject to this weird behaviour. A few days ago I could read my GPS data on Beaglebone Black (latest Debian) on ttyO4 using cat /dev/ttyO4 But since yesterday whenever I try this ...
2
votes
2answers
93 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 ...
0
votes
3answers
98 views

I want to copy a remote txt file via SSH, but without using root access

I want to copy my hosts to remote /etc/hosts but it doesn't work. I know root SSH access makes things easier, but IMHO root SSH access is a little dangerous. cat /etc/hosts|ssh samba2 "sudo su -c "...
1
vote
1answer
49 views

Creating a virtual file whose contents are determined programmatically [duplicate]

Is it possible to create a virtual file in unix, whose contents are determined programmatically when the file is accessed, a bit like the files in /proc? For example, I have a program that retrieves ...
1
vote
3answers
125 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ú*@...
0
votes
1answer
33 views

Cat won't access file in openSuse Tumbleweed ('Invalid argument' error)

I have just installed the latest version of openSuse Tumbleweed and was going through the file system familiarising myself with it when I found a file in /dev/lightnvm called 'control'. I attempted to ...
1
vote
2answers
70 views

Why does Linux not allow `cat`ing a directory? [duplicate]

I read in The Design of the UNIX Operating System that directories are files containing the names of each file they contain. So I tried cating one on my Mac, and it resulted in an error: cat: ./: Is a ...
1
vote
4answers
79 views

cat results of grep

I am trying to concatenate the results of my grep search. my grep search finds about 4 files on my system and outputs them in a new line for each file. I thought by passing this information to tr '\n' ...
-4
votes
1answer
69 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 > ...
3
votes
3answers
339 views

/bin/cat: Argument list too long

I have 119766 files in a folder. They are CSV files. I want to find out total number of lines of all files. I'm trying to run following command: cat * |wc -l But the following error occurrs: ...
3
votes
1answer
52 views

How to upload a file and then check it and run some other commands using only ssh, cat, and diff in a single SSH session?

The goal is to change some parameters on a lot of devices on connections that are kind of unreliable (wireless)--according to csv that has the format: IP,Parameter,Parameter I would like to make a ...
1
vote
2answers
59 views

how to store output of echo and cut to a variable

I have a file named test which has two columns one having ID and other having status. I want to loop through the file and print IDs where status have one particular value (e.g. 'ACTIVE'). I tried ...
1
vote
2answers
27 views

How can I paginate a UTF-8 file and see the right characters?

If I use cat on a file containing UTF-8, it displays properly: % cat /tmp/sample <concept code="endangeredLanguage"> <description value="The language is endangered at the given date"@en/&...
3
votes
4answers
113 views

Provide default value if command returns with non-zero exit code

I have some configuration in file config and would like to cat that file. However, sometimes config doesn't exist. In this case, I would like to have my command output a default value. Perhaps ...
1
vote
1answer
110 views

cut column range sed/awk/cat

I'd like to cut a certain range of text (i.e. characters 17-63) repeatedly from a *.txt file, which is several thousand lines long. One line looks like this: <script>addRow("...
60
votes
4answers
5k views

Difference between “cat” and “cat <”

I was working through a tutorial and saw use of both cat myfile.txt and cat < myfile.txt. Is there a difference between these two sequences of commands? It seems both print the contents of a file ...
6
votes
2answers
406 views

Why do here-documents attempt shell substitution even on a commented line?

I wanted to see how some ASCII art looked in terminal so: $ cat <<EOF ...
1
vote
3answers
85 views

Can I redirect the output of a program to cat with a pipe?

I have a folder with three files and basic contents: $ tail * ==> file1 <== file 1 contents ==> file2 <== file 2 contents ==> file3 <== file 3 contents I would like to see the ...
1
vote
2answers
62 views

Cat all files in a folder including filename by using a for loop?

With this for loop which I execute directly in the shell, I am able to cat the contents of all files in a folder, with the value beside of it: $ for f in *; do echo -e "\t"$f"\n"; cat $f; done ...
2
votes
1answer
93 views

cat [file..] pipe another cat command

cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" can someone explain how the quotations works. From what I understand. I am reading ...
2
votes
1answer
54 views

Sanity check (MD5 sums) fails after joining a file

I'm having a problem passing a sanity check, when combining a split file back to its original state even if it tarred with atime-preserve. Example below. filename=FILENAME newfilename=FILENAME2 ...
1
vote
2answers
199 views

Why does the following shell sequence ends so quickly?

Let be the files com and fic whith the access rights defined in the following shell sequence: $ cat com if tty>/dev/null then read x else read x<fic fi echo $x $ cat fic abcd $ ls -l ...
3
votes
5answers
310 views

Concatenate contents from stdout and from file

How can we concatenate results from stdout (or stderr) and a file into a final file. For example ls -a | grep text1 concatenate with file2.txt into a final result (not file2.txt), without storing ...
0
votes
1answer
71 views

how to send data from serial port to printer?

I have a telephone system that is connected to my old Ubuntu machine and is receiving SMDR data from it. Connected to dev/lp0 is a dot matrix printer, phone system connected to /dev/ttyS0 Currently I ...