- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting help reqd
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
тАО04-05-2004 09:24 AM
тАО04-05-2004 09:24 AM
I have a set of files in a directory they are archieves from Oracle for eg;
*********************************************
/oracle/TRN/saparch
#ls -ltr
PRDarch1_32690.dbf
PRDarch1_32691.dbf
PRDarch1_32692.dbf
**********************************************
What I want to do is to rename the first 3 characters ie "PRD" to "TRN" and the rest of the things would remain the same so the out put would be
TRNarch1_32690.dbf
TRNarch1_32691.dbf
TRNarch1_32692.dbf
Is there a way to script it out?
Thnks
SK
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2004 09:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2004 09:44 AM
тАО04-05-2004 09:44 AM
Re: Scripting help reqd
I'll get you started:
cd /oracle/TRN/saparch
ls PRDarch*.dbf | while read X
do
NEW=$(echo "${X}" | sed 's/^PRD/TRN/')
echo "${X} -> ${NEW}"
mv "${X}" "${NEW}"
done
I would probably add some testing to make sure that the new files does not already exist before doing the mv. The quotes are important because your filenames might contain whitespace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2004 09:47 AM
тАО04-05-2004 09:47 AM
Re: Scripting help reqd
for prd in `ls /oracle/TRN/saparch`
do
trn=`echo $prd | sed 's/PRD/TRN/'`
mv $prd $trn
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2004 09:48 AM
тАО04-05-2004 09:48 AM
Re: Scripting help reqd
Thnks for the quick response.
Pl close this form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2004 09:02 PM
тАО04-05-2004 09:02 PM
Re: Scripting help reqd
These are oracle's offline redolog files.
Changeing their name will make them invisible for oracle in case you need to recover your database.
Also the SAP tool brarchive won't be able to back them up.
If you've renamed your database/SAP instance you should also adjust the naming of you offline redo logfiles in $ORACLE_HOME/dbs/init
log_archive_dest='/oracle/TRN/oraarch/TRNarch'
regards,
Bart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:56 AM
тАО04-06-2004 04:56 AM
Re: Scripting help reqd
Thnks for your suggestion. The thing is we are doing a rcp from our production server to another server. So , the names need to be different in another system.
Thnks
SK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 08:59 PM
тАО04-06-2004 08:59 PM
Re: Scripting help reqd
if you've renamed your database after the rcp to oyou will have pen your database with the RESETLOGS option. This means that old offline redolog files are unuseable.
If this is the case you can delete the old offline redologfiles instead of renaming them.
regards,
Bart