HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- gtar & pattern matching script problem
Operating System - HP-UX
1831435
Members
3331
Online
110025
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
08-27-2002 05:59 PM
08-27-2002 05:59 PM
gtar & pattern matching script problem
HI,
I know that this problem is very similar in nature to the thread on "gtar-extracting tape contents." But I'd like some help with some scripts provided this thread.
I have 7 tapes contains archived filesystems of the form:
/bak/fs37/opt_regression
/bak/fs37/fourier_calc
/bak/fs20/run_script
(list continues ...)
Every archived filesystems have the /bak as the prefix in the filesystem name.
I would like to have these filesystems extracted from the tape and restored as:
/fs37/opt_regression
/fs37/fourier_calc
/fs20/run_script
NOT as
/bak/fs37/opt_regression
/bak/fs37/fourier_calc
/bak/fs20/run_script
I have a script written by Ceesjan Van Hatum which should ignore the /bak prefix during restore, but somehow it DID NOT:
#cat ceesjan.sh
#!/bin/sh
for i in `gtar -tvf /dev/rmt1`
do
echo "Retrieving $i"
gtar -xvf /dev/rmt $i
mv /bak/$i /$i
done
Could someone please show me how I should do a pattern match to extract only the of suffixes /bak from the tapes?
e.g:
/bak/fs37/opt_regression to be extracted and restored as /fs37/opt_regression
Or are there any other alternatives to this problem?
Could someone please help?
Thanks in advance.
I know that this problem is very similar in nature to the thread on "gtar-extracting tape contents." But I'd like some help with some scripts provided this thread.
I have 7 tapes contains archived filesystems of the form:
/bak/fs37/opt_regression
/bak/fs37/fourier_calc
/bak/fs20/run_script
(list continues ...)
Every archived filesystems have the /bak as the prefix in the filesystem name.
I would like to have these filesystems extracted from the tape and restored as:
/fs37/opt_regression
/fs37/fourier_calc
/fs20/run_script
NOT as
/bak/fs37/opt_regression
/bak/fs37/fourier_calc
/bak/fs20/run_script
I have a script written by Ceesjan Van Hatum which should ignore the /bak prefix during restore, but somehow it DID NOT:
#cat ceesjan.sh
#!/bin/sh
for i in `gtar -tvf /dev/rmt1`
do
echo "Retrieving $i"
gtar -xvf /dev/rmt $i
mv /bak/$i /$i
done
Could someone please show me how I should do a pattern match to extract only the of suffixes /bak from the tapes?
e.g:
/bak/fs37/opt_regression to be extracted and restored as /fs37/opt_regression
Or are there any other alternatives to this problem?
Could someone please help?
Thanks in advance.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 06:40 PM
08-27-2002 06:40 PM
Re: gtar & pattern matching script problem
does it give an error message ?. does "/fs37/opt_regression" already exist in the box ?. If yes move it to another name. then run the same script. that should work .
A best solution to the problem is, to avoid taking backups with absolute path. When you take backup take it with a relative path i mean , if u need to backup /fs37/opt_regression directory take it like "./fs37/opt_regression" so that u can directly restore it any where.
do give a try in the test box. then go to prod. box
kaps
A best solution to the problem is, to avoid taking backups with absolute path. When you take backup take it with a relative path i mean , if u need to backup /fs37/opt_regression directory take it like "./fs37/opt_regression" so that u can directly restore it any where.
do give a try in the test box. then go to prod. box
kaps
Nothing is impossible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 06:44 PM
08-27-2002 06:44 PM
Re: gtar & pattern matching script problem
Kapil,
Unfortunately I can't change the way it has been archived into the tapes. This is because these tapes were shipped from overseas.
Any other ideas?
Thanks.
Unfortunately I can't change the way it has been archived into the tapes. This is because these tapes were shipped from overseas.
Any other ideas?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2002 07:32 PM
08-27-2002 07:32 PM
Re: gtar & pattern matching script problem
You can get the suffix of /bak like this:
cut -d\/ -f3-
for example,
echo /bak/fs37/fourier_calc | cut -d\/ -f3-
will give you
fs37/fourier_calc
Assuming you have a valid & usable /bak on your system, the following script should extract one directory at a time into /bak and then move it to $extract_dir. (Not tested, you may have to make some small changes.)
#!/bin/sh
extract_dir=
cd /bak
for i in `gtar -tvf /dev/rmt1`
do
echo "Retrieving $i"
gtar -xvf /dev/rmt $i
j=`echo $i | cut -d\/ -f3-`
mv $j ${extract_dir}/${j}
done
cut -d\/ -f3-
for example,
echo /bak/fs37/fourier_calc | cut -d\/ -f3-
will give you
fs37/fourier_calc
Assuming you have a valid & usable /bak on your system, the following script should extract one directory at a time into /bak and then move it to $extract_dir. (Not tested, you may have to make some small changes.)
#!/bin/sh
extract_dir=
cd /bak
for i in `gtar -tvf /dev/rmt1`
do
echo "Retrieving $i"
gtar -xvf /dev/rmt $i
j=`echo $i | cut -d\/ -f3-`
mv $j ${extract_dir}/${j}
done

The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP