- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Command to copy range of files.
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
Forums
Discussions
Discussions
Discussions
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
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
04-27-2006 02:56 AM
04-27-2006 02:56 AM
Command to copy range of files.
cp fsprod_arch_70{36,37,38,39,40,41,42,43}.log /arch01/fsprod
I need to mention range of values like [36-43]but the follwing commands are not working:
cp fsprod_arch_70{36-43}.log /arch01/fsprod
cp fsprod_arch_70[36-43].log /arch01/fsprod
Any idea how to specify ranage of values?
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 03:03 AM
04-27-2006 03:03 AM
Re: Command to copy range of files.
cp sprod_arch_70[3-4][6-3].log /arch01/fsprod
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 03:05 AM
04-27-2006 03:05 AM
Re: Command to copy range of files.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 03:14 AM
04-27-2006 03:14 AM
Re: Command to copy range of files.
on a single line you probably have to something like this:
# cp fsprod_arch_703[6-9].log fsprod_arch_704[0-6].log /arch01/fsprod
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 03:14 AM
04-27-2006 03:14 AM
Re: Command to copy range of files.
LOW=36
HIGH=43
INDEX=${LOW}
while [ ${INDEX} -le ${HIGH} ]
do
FILELIST="${FILELIST} fsprod_arch_70${INDEX}.log"
done
cp ${FILELIST} /arch01/fsprod
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 04:07 AM
04-27-2006 04:07 AM
Re: Command to copy range of files.
I think this while loop may be executing for a rather long time:
while [ ${INDEX} -le ${HIGH} ]
do
FILELIST="${FILELIST} fsprod_arch_70${INDEX}.log"
done
It might benefit from an increment of ${INDEX} somewhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 04:16 AM
04-27-2006 04:16 AM
Re: Command to copy range of files.
LOW=36
HIGH=43
INDEX=${LOW}
while [ ${INDEX} -le ${HIGH} ]
do
FILELIST="${FILELIST} fsprod_arch_70${INDEX}.log"
INDEX=$((${INDEX}+1))
done
cp ${FILELIST} /arch01/fsprod
That'll teach me to type in a hurry. (Well, ok, probably not.) :)
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 04:35 AM
04-27-2006 04:35 AM
Re: Command to copy range of files.
If we are going to loop and increment, it's faster to use integer arithmetic by declaring our variables with 'typeset'. Too, we only need a LOW and a HIGH variable.
#!/usr/bin/sh
typeset -i LOW=36
typeset -i HIGH=43
while (( LOW <= HIGH ))
do
cp fsprod_arch_70${LOW}.log /arch01/fsprod
(( LOW=${LOW}+1 ))
done
exit 0
Regards!
...JRF...