- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problem with SED in shell script
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
тАО12-26-2002 12:51 AM
тАО12-26-2002 12:51 AM
Problem with SED in shell script
I have a strange problem with sed in shell scripts on HP-UX 11.0.
The scripts is like this:
sed -e "s,dummyPort,$PORT,g" < /tmp/new-httpd1.conf >/tmp/new-httpd2.conf
sed -e "s,dummysslPort,$SSL_PORT,g" < /tmp/new-httpd2.conf >/tmp/new-httpd.conf
In the above two sed functions, first sed works fine. Second one gives the following error:
"sed: Function s,dummysslPort,443 cannot be parsed"
I even tried the following:
sed -e "s/a/b" -e "s/b/c" < file1 >file2. This also gives the same error.
I even replaced -e with -n and tried. Still does not work.
Any ideas? Please help.
Thanks,
Nagendar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 01:02 AM
тАО12-26-2002 01:02 AM
Re: Problem with SED in shell script
's/$/
'
and the problem went away. I have no idea if that is a reasonable way
to fix it, though.
--chakri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 01:26 AM
тАО12-26-2002 01:26 AM
Re: Problem with SED in shell script
You mean to say replace double quotes (") with with single quotes (') ?
Yes, that works fine. But the problem is that takes the literal values. I mean you can't use a variable in that case. That is another side problem of using single quotes.
Looking forward for more solutions.
Regards,
Nagendar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 02:45 AM
тАО12-26-2002 02:45 AM
Re: Problem with SED in shell script
Perhaps problems are not the same ...
In the first case, what is the content of $SSL_PORT ? If it contains a ',' it could generate errors due to string evaluation before execution. Try with another separator like / or ; ...
In your second sed problem, just add a final / and it will work (you must always have a third time the fiel separator.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 06:19 AM
тАО12-26-2002 06:19 AM
Re: Problem with SED in shell script
The port does not contain the ",".
Regarding the second suggetion, I have put the third file seperator too in the sed. It does not solve the problem :(
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 07:22 AM
тАО12-26-2002 07:22 AM
Re: Problem with SED in shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 09:33 AM
тАО12-26-2002 09:33 AM
Re: Problem with SED in shell script
Try this:
sed -e 's/dummysslPort/'$SSL_PORT'/g' < /tmp/new-httpd2.conf >/tmp/new-httpd.conf
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-26-2002 08:26 PM
тАО12-26-2002 08:26 PM
Re: Problem with SED in shell script
Thanks for the suggetion. My actual problem was with the value of SSL_PORT. There was some messup. Thats been resolved. Thanks anyway.
I am closing the message now!
Regards,
Nagendar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-27-2002 12:56 AM
тАО12-27-2002 12:56 AM
Re: Problem with SED in shell script
do
cat /tmp/new-httpd2.conf |sed -e "s;dummysslPort;$SSL_PORT;g" >>/tmp/new-httpd.conf
It will work please give a try
Cheers ............
kaps