Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-30-2005, 09:48 AM   #1
LQ Newbie
Registered: Nov 2004
Distribution: Scientific Linux 6.4
Posts: 22

Rep: Reputation: 0
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)

Old 05-30-2005, 09:57 AM   #2
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
cat $file1 $file2 &> output
Old 05-30-2005, 10:00 AM   #3
Registered: Dec 2004
Location: Netherlands
Distribution: Slackware
Posts: 173

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

But the file is created just fine.
Old 05-30-2005, 10:06 AM   #4
LQ Newbie
Registered: Nov 2004
Distribution: Scientific Linux 6.4
Posts: 22

Original Poster
Rep: Reputation: 0
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...

Old 05-30-2005, 10:36 AM   #5
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Able to write files to MP3 player but no files written into actual device? olnex Linux - Hardware 0 11-11-2005 07:32 AM
How program to read files with extension .dat y .cfg files COMTRADE in fedora 1? ivonne Linux - Software 0 11-22-2004 12:42 PM
How can konqueror view html files in .gz & .bz2 files directly? ailinzhe Linux - Software 5 05-24-2004 09:36 AM
concatenating strings to open files veilig Programming 1 11-10-2003 06:36 PM
How to filter files in files and files which are in a sub-directory with "grep"? Piero Linux - Newbie 9 08-29-2003 03:38 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration