- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- use of sed command in HP-UX vs Linux
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
тАО08-23-2010 11:55 PM
тАО08-23-2010 11:55 PM
The following command works fine in Linux
sed -e 's/\(<\/\w*:\w*\>\)./\1>\n/g' "$tempResponseXmlFile" > "$responseXmlFile"
which basically does some scripting and copies the result in the $responseXmlFile.
But when the same is executed in HP_UX, it gives no error, but the $responseXmlFile shows 0 bytes.
For your ref, the $tempResponseXmlFile is attached to this message.
Any ideas on converting the above command for HP-UX sed ?
Thanks
Gerard
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2010 01:22 AM
тАО08-24-2010 01:22 AM
Re: use of sed command in HP-UX vs Linux
uname -a
> Any ideas on converting the above command
> for HP-UX sed ?
That would require some thinking. It might
be easier to install GNU "sed" on the HP-UX
system, and then use that.
http://www.gnu.org/software/sed/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2010 04:00 AM
тАО08-24-2010 04:00 AM
Re: use of sed command in HP-UX vs Linux
The GNU 'sed' is far superior to HP-UX's as Steven suggested. That said, you could use Perl with a slight modification to your regular expression:
# perl -pe 's/(<\/\w*:\w*\>)./$1>\n/g' file
Notice that we don't need to escape the opening and closing parentheses. In fact, this allows the capture. The result of the capture (the back-slashed '1') is better written as '$1' so we do that too.
We can make things even more readable by using non '/' delimiters:
# perl -pe 's{(<\/\w*:\w*\>).}{$1>\n}g' file
And if you like, you can update "in-place" (which I believe also exists in GNU 'sed'):
# perl -pi.old -e 's{(<\/\w*:\w*\>).}{$1>\n}g' file
The above preserves a copy of the original file named "*.old".
Regards!
...JRF..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2010 11:57 PM
тАО08-24-2010 11:57 PM
Re: use of sed command in HP-UX vs Linux
I was actually looking if something could be done using the HP-UX sed itself.
Anyways, since in our project, we are already using GNU "wget", we have decided to also include the GNU "sed", since our scripts need to be compatible with Linux, HP-UX and AIX.
Cheers
Gerard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 01:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 01:34 AM
тАО08-25-2010 01:34 AM
Re: use of sed command in HP-UX vs Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 01:57 AM
тАО08-25-2010 01:57 AM
Re: use of sed command in HP-UX vs Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:38 AM
тАО08-25-2010 06:38 AM
Re: use of sed command in HP-UX vs Linux
> GNU "sed", since our scripts need to be
> compatible with Linux, HP-UX and AIX.
If you expect scripts to be portable, then
you probably need to use only features which
are common to all the systems involved. This
might mean using only a subset of features
which are naturally common, or else
installing the feature-rich (GNU) programs
everywhere.
AIX may need some help, too.
One problem with GNUware these days is that
some of it tends to require more of it than
one might expect, leading to more maintenance
than one might expect. Linux systems might
get updates more-or-less automatically, but
the other ones are all your problem. For
portability, there's much to be said for
developing scripts (or any other software) in
the lamest environment you can find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:57 AM
тАО08-25-2010 06:57 AM
Re: use of sed command in HP-UX vs Linux
> Steven: One problem with GNUware these days is that some of it tends to require more of it than one might expect, leading to more maintenance than one might expect.
And in this case, Perl's regex engine will do everything you need in a fashion that will indeed be portable and virtually, universally available ;-)
Regards!
...JRF...