Concat files with similar names in different directories

Reply

Join Date: Jun 2007
Posts: 7
Reputation: slbit is an unknown quantity at this point 
Solved Threads: 0
slbit slbit is offline Offline
Newbie Poster

Concat files with similar names in different directories

 
0
  #1
Jun 8th, 2007
Dear Experts,

to give a better picture i will explain the directory structure first

the files have the same naming convention and the only difference is the first letters which is the title of that account, there is a total of 210 files only the bold letters change for each file
exe: file 1,
/Data/KG-02/ACT/KG-02-PEF-RHOX-NOR.dat
file 2
/Data/KG-64/ACT/KG-64-PEF-RHOX-NOR.dat

+>Data
-----> /KG-02
-------->/ACT/
-------->KG-02-PEF-RHOX-NOR.dat
i have to concatinate these file with all the other files of similar name in the different directories, so i can have one account summary.

id appreciate any help
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 54
Reputation: radoulov is an unknown quantity at this point 
Solved Threads: 5
radoulov's Avatar
radoulov radoulov is offline Offline
Junior Poster in Training

Re: Concat files with similar names in different directories

 
0
  #2
Jun 10th, 2007
Shell Scripting Syntax (Toggle Plain Text)
  1. for i in Data/KG-*;do cat "$i"/ACT/*dat>"${i##*/}.dat";done
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 7
Reputation: slbit is an unknown quantity at this point 
Solved Threads: 0
slbit slbit is offline Offline
Newbie Poster

Re: Concat files with similar names in different directories

 
0
  #3
Jun 11th, 2007
thanks, but i got an error message declaring illegal variable name
Originally Posted by radoulov View Post
Shell Scripting Syntax (Toggle Plain Text)
  1. for i in Data/KG-*;do cat "$i"/ACT/*dat>"${i##*/}.dat";done
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 54
Reputation: radoulov is an unknown quantity at this point 
Solved Threads: 5
radoulov's Avatar
radoulov radoulov is offline Offline
Junior Poster in Training

Re: Concat files with similar names in different directories

 
0
  #4
Jun 11th, 2007
You're using a very old shell, try with a different one: bash, ksh, zsh (for example, do not use /usr/bin/sh on Solaris).
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 7
Reputation: slbit is an unknown quantity at this point 
Solved Threads: 0
slbit slbit is offline Offline
Newbie Poster

Re: Concat files with similar names in different directories

 
0
  #5
Jun 12th, 2007
Works Perfectly ,, Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC