LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   concatenating files (https://www.linuxquestions.org/questions/linux-software-2/concatenating-files-328516/)

s_siouris 05-30-2005 08:48 AM

concatenating files
 
Hello all,
I am trying to join two text files together as a part of a shell script by using:
cat $file1 $file2 > output
My problem is that although this command works ok, but it also displays both file's contents to the shell output. Have you go any ideas how to avoid this output to the shell? (cat -u did not work)

Cheers
Spiros

Andrew Benton 05-30-2005 08:57 AM

cat $file1 $file2 &> output

nukey 05-30-2005 09:00 AM

I don't get any output on the screen when I use your command s_siouris.

But the file is created just fine.

s_siouris 05-30-2005 09:06 AM

sorry guys, my mistake: I was also using the "detex" command to strip all latex commands (I am writing a shell script to act as a word count), and this was causing the output to stdout and not the cat command...

Cheers
Spiros

jschiwal 05-30-2005 09:36 AM

I haven't had the output of cat echo'ed on the screen then redirecting the output to a file.

doing "cat $file1 $file2 &> output"
may place both streams in the file corrupting the output.

Do your files contain odd characters such as the redirection characters. If so, place the input filenames in double quotes.

You might want to look in the other parts of the script for a reason. Such as a 1&>2 somewhere earlier.


All times are GMT -5. The time now is 10:13 PM.