The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find a file and xarg mv to append date to file jacktravine SUN Solaris 6 10-05-2009 12:27 PM
find, if exists then append for file with same name RubinPat Shell Programming and Scripting 8 05-18-2009 10:40 PM
search directory-find files-append at end of line PrasannaKS Shell Programming and Scripting 1 03-02-2009 11:15 AM
need to help to find and copy to a file pujars1 UNIX for Dummies Questions & Answers 2 07-12-2007 10:56 AM
find and copy string in a file vascobrito UNIX for Advanced & Expert Users 10 03-03-2004 02:14 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-21-2009
euspilapteryx euspilapteryx is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 7
Find, copy, and append into one file

Hi, I am trying to do something relatively easy, but am having some trouble getting it to work.

I have multiple files called "distances.log" in numerous subdirectories and sub-subdirectories within a directory. I would like the contents of each of these "distances.log" files to be appended to a single, new file called "distances_summary.log".

I know there are numerous ways to do this, but

Of the numerous things I tried, I tried:

find ./ -name "*distance.log" > distances_summary.log

and various modifications of it (trying not to print the path, but the contents of each). I think there's a much easier solution that I am not aware of. I know this is really silly - maybe I just need to take a break...

Thanks
  #2 (permalink)  
Old 10-22-2009
thegeek thegeek is offline
Registered User
  
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 453
Code:
find -iname "*distance.log" -exec cat {} >> distance_summary.log \;
  • find the files,
  • cat those files into required file.
  #3 (permalink)  
Old 10-22-2009
euspilapteryx euspilapteryx is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 7
Great, thanks! I knew I should use "cat"...
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0