- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: 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
Forums
Discussions
Discussions
Forums
Discussions
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
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