- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- hp ux version of sed command
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
тАО07-02-2009 11:09 AM
тАО07-02-2009 11:09 AM
sed '/Pattern/,+4 d' - works fine in Linux.
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 12:06 PM
тАО07-02-2009 12:06 PM
Re: hp ux version of sed command
Did you try it in HP-UX?
Does it actually work differently than in Linux?
sed is kind of sed. I can't remember it acting differently in HP-UX and Linux. I'm not a heavy user but have exchanged sed scripts between the two without a second thought.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 12:09 PM
тАО07-02-2009 12:09 PM
Re: hp ux version of sed command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 01:23 PM
тАО07-02-2009 01:23 PM
Re: hp ux version of sed command
I thought that it worked on HP-UX, but that it was supposed to be dot relative (.+4). Could not get it to work...
Scratching my head I hopped into vi and used the colon escape ":g/Pattern/,.+4 d" and it worked just fine. Everybody is gone for the holiday, perhaps an answer will show up next week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 02:02 PM
тАО07-02-2009 02:02 PM
SolutionWell the GNU versions of many utilities are far more feature-rich than the HP-UX ones, so this doesn't surprise me in the least.
In fact, the GNU documentaion notes that the form:
addr1,+N
...is a GNU extension that matches addr1 and the N lines following addr1.
We can emulate your 'sed' command by using a bit of Perl which in this case is easy enough to deduce:
# perl -ne 'm/Pattern/ and $i=1,next;next if $i && $j++<4;print' file
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2009 02:18 PM
тАО07-02-2009 02:18 PM
Re: hp ux version of sed command
If you like, you can fetch a GNU 'sed' from the Porting Centre. Be sure to get the run-time dependencies for a binary; or the build-time dependencies if you are compiling your own.
http://hpux.connect.org.uk/hppd/hpux/Gnu/sed-4.2.1/
Lastly, as a new member to the ITRC, welcome! When you are satisfied with the answers you have received, please read:
http://forums.itrc.hp.com/service/forums/helptips.do?#28
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2009 08:32 AM
тАО07-03-2009 08:32 AM
Re: hp ux version of sed command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2009 09:20 AM
тАО07-03-2009 09:20 AM
Re: hp ux version of sed command
Assigning points is a way of saying "thank you" and marking the thread to indicate to future readers which answers helped you to resolve your problem. Points increase the value of our community.
http://forums.itrc.hp.com/service/forums/helptips.do?#28
Regards!
...JRF...