The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
processing file names using text files ligander Shell Programming and Scripting 5 12-01-2008 06:32 PM
Merge two files whose names are given in other file harshada Shell Programming and Scripting 1 10-01-2008 05:17 AM
Insert first line of a file to first column of remaining files a_artha Shell Programming and Scripting 5 07-28-2008 06:47 AM
how to remove files with only numbers as file names? praveen_indramo Shell Programming and Scripting 6 06-07-2007 10:13 AM
How can I delete files using a file that containt path and names? AlvaroD UNIX for Dummies Questions & Answers 2 09-25-2001 01:51 PM

Closed Thread
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 06-05-2009
samky2005 samky2005 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 2
Question Insert file names when concatenate files into a file

Hi

I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile".

cat test_* >> bigfile

But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile".

Thank you
samky2005
  #2 (permalink)  
Old 06-05-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,345
You can use a loop like this:


Code:
for i in test_*; do echo Filename : "$i";echo;cat "$i"; done > bigfile

  #3 (permalink)  
Old 06-05-2009
samky2005 samky2005 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 2
Quote:
Originally Posted by Franklin52 View Post
You can use a loop like this:


Code:
for i in test_*; do echo Filename : "$i";echo;cat "$i"; done > bigfile

Thank you so much!
It worked.
Closed Thread

Bookmarks

Tags
concatenate, insert

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 01:20 AM.


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