I know a fair bit about escape characters in BASH. I know that \ will escape the next character, " " will escape all characters except for $ and ", and finally ' ' will escape all characters except for '.
So if for example I have text with some single quotes ' in it, I can put " " around it to make it behave like a single text string.
The problem I have is when my file contains both double and single quote characters. Then, I cannot use either type of quotes to escape it. So how do I ask bash to treat it as a single string?
Context: My iPhone's /var/mobile/Library/Safari/History.plist file. It contains something like:
<key>
<string>http://example.com/folder/index.html</string>
<string>Title of Webpage which may include ' and "</string>
</key>
I want to cat the file, pass it through grep to take the first line containing the text string and extract the URL from that.
But grep chokes on all the quotes.
Edit 1: Here are some screenshots of nano failing to read the file. Cat gives similar output. The graphical file editor iFile reads it as text. http://cloudrac3r.ddns.net/strange.html I am told this is what binary files do. I will do some experimenting.
cat /path/History.plistto read the file to stdin (works fine) and then putting ` | grep string` on the end. Grep return nothing.grep 'Title of Webpage which may include '\'' and "'orgrep "Title of Webpage which may include ' and \""