- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk,trap,sed
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
11-26-2002 01:20 AM
11-26-2002 01:20 AM
1)`awk -F: '$6 == "'$serial'" {print $2}' database`"
2)trap '' 1 2 3 18
3)sed "/$cserial/d" database > delete
thank you very much...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2002 01:25 AM
11-26-2002 01:25 AM
Solution1) split each line in "database" at the ":" character, and print the 2nd field if the 6th field is the value of $serial
2) ignore signals 1, 2, 3, 18
3) delete any lines containing the $cserial variable, and output the remaining lines to the file delete.
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2002 01:31 AM
11-26-2002 01:31 AM
Re: awk,trap,sed
2) reset the default behaviour to signals 1 (SIGHUP), 2 (SIGINT), 3 (SIGQUIT), 18 (SIGCHLD),
assumably because a signal handler for these signals was defined earlier in the script
3) from file database delete every line where the contents of variable $cserial matches, and redirect output to file delete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2002 01:53 AM
11-26-2002 01:53 AM
Re: awk,trap,sed
1 - OK
2 - IGNORE signals ... To restore to default handling you should have nothing between 'trap' and signals list (no '')
3 - Only remaining lines are redirected to output file.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2002 09:45 AM
11-26-2002 09:45 AM
Re: awk,trap,sed
you both were right of course.
I simply mistook it because I hardly ever set traps in shell scripts anymore but instead use Perl whenever I have to implement a signal handler somewhere, where you simply could say something like
$SIG{HUP} = $SIG{INT} = $SIG{QUIT} = $SIG{CHLD} = 'IGNORE';
Sorry, if I had noticed that Robin already has posted a reply I definitely wouldn't have responded at all.
So I guess we had a kind of race condition here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2002 04:52 AM
11-28-2002 04:52 AM