- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need command or script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 07:52 PM
тАО12-16-2009 07:52 PM
I am looking out for script or commands for below.
I have some instances in a logs directory as follows:
/logs/a/b/c/d/xyz-instance-1/some.log
/logs/a/b/c/d/xyz-instance-2/some.log
/logs/a/b/c/d/xyz-instance-3/some.log
/logs/a/b/c/d/xyz-instance-4/some.log
/logs/a/b/c/d/xyz-instance-5/some.log
I want to copy above in /tmp/ direcotry having below path and names.
/tmp/some.log-xyz-instance-1
/tmp/some.log-xyz-instance-2
/tmp/some.log-xyz-instance-3
/tmp/some.log-xyz-instance-4
/tmp/some.log-xyz-instance-5
Can someone please suggest commands or script ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 08:13 PM
тАО12-16-2009 08:13 PM
Re: Need command or script
for file in /logs/a/b/c/d/*/some.log; do
cp "$file" \
"`echo "$file" | sed 's,/logs/a/b/c/d/\(.*\)/some.log,/tmp/some.log-\1,'`"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 08:41 PM
тАО12-16-2009 08:41 PM
Re: Need command or script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 08:45 PM
тАО12-16-2009 08:45 PM
Re: Need command or script
% find logs
logs
logs/a
logs/a/b
logs/a/b/c
logs/a/b/c/d
logs/a/b/c/d/instance-1
logs/a/b/c/d/instance-1/some.log
logs/a/b/c/d/instance-2
logs/a/b/c/d/instance-2/some.log
logs/a/b/c/d/instance-3
logs/a/b/c/d/instance-3/some.log
logs/a/b/c/d/instance-4
logs/a/b/c/d/instance-4/some.log
% ls tmp
% for file in logs/a/b/c/d/*/some.log; do
cp "$file" \
"`echo "$file" | sed 's,logs/a/b/c/d/\(.*\)/some.log,tmp/some.log-\1,'`"
done
% find tmp
tmp
tmp/some.log-instance-1
tmp/some.log-instance-2
tmp/some.log-instance-3
tmp/some.log-instance-4
%
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 09:21 PM
тАО12-16-2009 09:21 PM
Re: Need command or script
> actual paths [...]
If you can't figure out how to adapt a
suggestion to your actual data, and you
expect someone else to do your _whole_ job
for you, then it might make some sense to
provide the actual data. Or was your goal to
waste everyone's time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 09:39 PM
тАО12-16-2009 09:39 PM
Re: Need command or script
You have not provided any input then how you have wasted your time ?
I have been posting my questions on this forum for almost 5 years and no one raised concern so far.
If anyone do not have time to answer then it is fine.
If i have been very good in sed and awk then i would have never posted my question here.
Please do not post your answer for my question if you feel i am wasting your time.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 09:44 PM
тАО12-16-2009 09:44 PM
Re: Need command or script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 10:23 PM
тАО12-16-2009 10:23 PM
Re: Need command or script
Your (second) problem description did not
show what you did, nor the data you fed into
it. This makes it hard for someone with my
weak psychic powers to contribute much.
> [...] how you have wasted your time ?
Did I say that only _my_ time was wasted?
> Can you show the actual command you used,
> with the real paths? [...]
That looks to me like some wasted time.
As I said, "it might make some sense to
provide the actual data." Do you think that
not showing your actual commands and not
showing your actual data were helpful?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2009 10:41 PM
тАО12-16-2009 10:41 PM
Re: Need command or script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2009 05:04 AM
тАО12-17-2009 05:04 AM
Solution> These are production servers and i can't disclose any actual paths
I seriously doubt that this will compromise anything. What does it matter if I know the name of a path on a server if I can't get to the server in the first place?
Providing actual commands and actual filenames together with the actual error or warning message you received would help you solve your objective much faster.
Regards!
...JRF...