SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 8th, 2004, 06:58 AM
drona_unix drona_unix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 drona_unix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
need help urgently on unix scripting

same file(file name is same, but the content is different) exists on subdirectories of a particular directory.

for ex: i need to search a 'xlog' file which is present under 'cnet' directory (as well as subdirectories of cnet) and need to move to a new directory 'tempdir' by creating the directory of where it resides and copy that 'xlog' to that place.

/Ofwr.sys/xlog
/Ofwr.sys/cl7/archive/xlog
/Ofwr.sys/tdm/tbl/sfm1/xlog
/Ofwr.sys/tdm/trn/route/xlog
/Ofwr.sys/tdm/trn/gsc3/xlog

I tried.. but no luck..(as a single command)

find . -name xlog -exec cp {} tempdir \; (It tries to copy all the xlog files of different directories to the directory 'tempdir' and throwing error identical xlog, same file name, not creating directories)

cp -r /usr/cnet/*xlog tempdir (It's copying only the xlog file present in that cnet directory)

Thanx in advance for the help...

Reply With Quote
  #2  
Old July 8th, 2004, 06:59 AM
drona_unix drona_unix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 drona_unix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
same file(file name is same, but the content is different) exists on subdirectories of a particular directory.

for ex: i need to search a 'xlog' file which is present under 'cnet' directory (as well as subdirectories of cnet) and need to move to a new directory 'tempdir' by creating the directory of where it resides and copy that 'xlog' to that place.

/Ofwr.sys/xlog
/Ofwr.sys/cl7/archive/xlog
/Ofwr.sys/tdm/tbl/sfm1/xlog
/Ofwr.sys/tdm/trn/route/xlog
/Ofwr.sys/tdm/trn/gsc3/xlog

I tried.. but no luck..(as a single command)

find . -name xlog -exec cp {} tempdir \; (It tries to copy all the xlog files of different directories to the directory 'tempdir' and throwing error identical xlog, same file name, not creating directories)

cp -r /usr/cnet/*xlog tempdir (It's copying only the xlog file present in that cnet directory)

Thanx in advance for the help...

Reply With Quote
  #3  
Old July 9th, 2004, 06:34 AM
drona_unix drona_unix is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 drona_unix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation

I got it..
find . -name xlog | cpio -pdumv logfilesdir

extending this,
Is there any way we could concatenate the path names into the filename so that all files could be in the same directory at the top level?
Example:
i want the file name has to be Ofwr.sysxlog , Ofwr.syscl7archivexlog (/Ofwr.sys/xlog, /Ofwr.sys/cl7/archive/xlog) and copy total files into one directory

Thanx in advance for help..

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > need help urgently on unix scripting


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway