- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to replace " by \"
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
тАО04-22-2009 12:05 PM
тАО04-22-2009 12:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2009 12:10 PM
тАО04-22-2009 12:10 PM
Re: How to replace " by \"
For example:
$ echo 'by \' | sed -e 's!by \\!something else!g'
something else
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2009 12:21 PM
тАО04-22-2009 12:21 PM
Re: How to replace " by \"
Signal=$(myfunccall)
echo $Signal
=> Dump Event "user" sending
java -jar myclass.jar "$Signal_information"
=> I want to have only one parameter here like this
=> Dump Event \"user\" sending
Bests regards
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2009 12:44 PM
тАО04-22-2009 12:44 PM
Solution$ echo $Signal
Dump Event "user" sending
$ echo $Signal | sed 's/"/\\"/g'
Dump Event \"user\" sending
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2009 01:00 PM
тАО04-22-2009 01:00 PM
Re: How to replace " by \"
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2009 11:09 AM
тАО04-24-2009 11:09 AM
Re: How to replace " by \"
It may work well with other parsers.
It will backslash quote characters like spaces, quotes, and ampersands.
Here is an example with %s and %q formats.
$ printf "%s\n" 'try "double quoted" + '"'"'single quoted'"'"' & \t backquoted text'
try "double quoted" + 'single quoted' & \t backquoted text
$ printf "%q\n" 'try "double quoted" + '"'"'single quoted'"'"' & \t backquoted text'
try\ \"double\ quoted\"\ +\ \'single\ quoted\'\ \&\ \\t\ backquoted\ text