On Linux, I can use this sed command: sed -i ‘s/^”//’ example.txt
That deletes any quotation marks that are at the beginning of a line. It does it in-place, and while you have the option to rename the old file and replace it with a new file with the original name (using "sed -i.bak ‘s/^”//’ example.txt" would move the existing example.txt file to example.txt.bak and write a new one in-place), if you leave out the .bak, it just writes it in-place with no backup file.
On OS X, though, that command won't work. You have to specify a backup file, even if it's blank. "sed -i “” ‘s/^”//’ example.txt" would replace the text in-place without a backup. sed -i “.bak” ‘s/^”//’ example.txt would replace the file and move the original to "example.txt.bak".
Even with sed and awk, you still have to stop and wonder if it will work cross-platform.
If you used an operating system that shipped with BusyBox, you'd be similarly frustrated. But operating systems are tradeoffs with pros/cons. Using a different set of tools makes it distinct, not "out of date".
1. https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-c...
True, but I was thinking awk/sed was a good multi OS tool with minimal code effect.
Well that kills my idea why to use awk/sed. What would you use @freehunter?
Given that description, I'd agree. Now I understand the crux of the problem, problem solved using disposable code in terse language or script.
Awk/Sed are optimised for text/data processing.[0] While Bash might work, will the script work on all systems (and version)? [1] awk & predecessor sed are good for one liner programs and suitable for problems that need fast, reliable solutions.
reference
[0] Opening, closing files; reading, breaking and counting record fields.
[1] OS use Bash or Bourne? https://en.wikipedia.org/wiki/Bash_(Unix_shell)#Portability