- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- modify content of file
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
10-21-2007 07:12 AM
10-21-2007 07:12 AM
modify content of file
I have a problem. I am using glance to take out process memory area details using one adviser file format. My query is:
How to modify process id given in adviser file:
"if PROC_PROC_ID == 2244"
mean modifying process number (2244) using sed or tr?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2007 07:16 AM
10-21-2007 07:16 AM
Re: modify content of file
first create a template and put ZZZZ as process id in template file ;
second ,
tr -s "ZZZZ" processid < template_file > adviser file.
third ;
give adviser_file to glance,
I hope ıunderstand truely.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2007 07:25 AM
10-21-2007 07:25 AM
Re: modify content of file
the problem is ZZZZ will vary and have any process id to monitor. so, I am looking for command independent of existing process id in adviser file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2007 07:40 AM
10-21-2007 07:40 AM
Re: modify content of file
if you insist in not using templates:
otherpid=4711
awk -v newid=$otherpid'"' '$2=="PROC_PROC_ID" {$4=newid; print}' adviser1 >adviser2
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2007 12:37 PM
10-21-2007 12:37 PM
Re: modify content of file
Use Perl and you can update your adviser file "in place":
# perl -pi.old -e 'BEGIN{$pid=shift or die};s/(if PROC_PROC_ID\s*==\s*)(\d*)\b/\1$pid/' pid_value adviser
The original 'adviser' is retained as a backup called 'adviser.old'. No matter what the value of the pid in the string shown, it will be replaced with your value, passed as a first argument.
Thus in the example above, if you want a 'pid' value of 12345, pass that as the 'pid_value' and pass "adviser" (or whatever) as the filename.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2007 07:15 PM
10-23-2007 07:15 PM