The UNIX and Linux Forums  

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
Append to end of each line of file without a temp file. rorey_breaker Shell Programming and Scripting 4 04-03-2008 07:11 AM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 07:17 PM
Creating file contents using contents of another file ReV Shell Programming and Scripting 21 02-24-2006 06:25 AM
Reading specific contents from a file and appending it to another file dnicky Shell Programming and Scripting 5 10-04-2005 02:45 AM
Append a field to the end of each line of a file based on searching another file. ultimate Shell Programming and Scripting 2 03-29-2005 07:21 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-27-2006
Registered User
 

Join Date: Jun 2005
Posts: 26
append file name contents to a target file

Hi ,

I want to append the contents of many files (not knowing exactly how many files, i will get) in to one target file on a day today basis.
The file names are similar except last value (which is sequence number)

eg) file1_20061026_1
file1_20061026_2 etc.,

How can i read all the files one by one and append it to the target file.
I am very new to unix and it would be great if i get help from Unix Gurus.

Thanks in advance,
gops
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-27-2006
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 710
could be something like this:

Code:
root@mp-wst01 # echo "1" > file1_20_1
root@mp-wst01 # echo "2" > file1_20_2
root@mp-wst01 # for x in file1_20_* ; do cat $x >> target; done
root@mp-wst01 # more target
1
2
root@mp-wst01 #
regards pressy
Reply With Quote
  #3 (permalink)  
Old 10-27-2006
Registered User
 

Join Date: Jun 2005
Posts: 26
Thanks Pressy.

It worked.

Is it possible to assign the target file (in our example target) to some parameter file so that etl jobs can read the file name.

eg)
testparams (Parameter file name)
fromdate=
todate=
file_name=(here our target file name should appear)

Thanks in advance.
cheers,
gops
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0