HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script help
Operating System - HP-UX
1832255
Members
2543
Online
110041
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
09-22-2003 06:19 PM
09-22-2003 06:19 PM
shell script help
I am currently writing some script to use omniback to initialize a tape. After initialize it will automatcially add the media id to the backup specification pre-allocation list.
I need to search through this backup specificaton file inside /etc/opt/omni/datalists.
I need to search for prealloc keyword inside the file and append the new media id to this section and save the file.
DATALIST "test_backup"
DYNAMIC 1 5
DEFAULTS
{
FILESYSTEM
{
-no_storedrim
} -protect none
RAWDISK
{
}
}
DEVICE "abc_lto"
{
-pool "ABC"
-prealloc
"0a140507:3f6ab3f2:0e2d:0001"
----> I need to append the new media_id here..
}
HOST "abc.esc" abc.esc
{
-trees
"\"
-exclude
"C:\temp"
"G:"
"H:"
}
I need to search through this backup specificaton file inside /etc/opt/omni/datalists.
I need to search for prealloc keyword inside the file and append the new media id to this section and save the file.
DATALIST "test_backup"
DYNAMIC 1 5
DEFAULTS
{
FILESYSTEM
{
-no_storedrim
} -protect none
RAWDISK
{
}
}
DEVICE "abc_lto"
{
-pool "ABC"
-prealloc
"0a140507:3f6ab3f2:0e2d:0001"
----> I need to append the new media_id here..
}
HOST "abc.esc" abc.esc
{
-trees
"\"
-exclude
"C:\temp"
"G:"
"H:"
}
abc
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2003 03:37 AM
09-24-2003 03:37 AM
Re: shell script help
You could use "awk" (or perl) to scan the file look for the proper place and insert. Here is an example with "awk"-
awk -vnewid="$newid" '/^-prealloc/{gotpre=1};/^}/{if (gotpre) print newid ; gotpre=0};{print $0}' test
Assuming shell variable "newid" has the data line to add. This will scan for "-prealloc", then look for the first "}" and insert the extra line.
HTH
-- Rod Hills
awk -vnewid="$newid" '/^-prealloc/{gotpre=1};/^}/{if (gotpre) print newid ; gotpre=0};{print $0}' test
Assuming shell variable "newid" has the data line to add. This will scan for "-prealloc", then look for the first "}" and insert the extra line.
HTH
-- Rod Hills
There be dragons...
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