I'm sure this is pretty simple but I can't seem to find a good example. I'm trying to parse /proc/1/exe to find the init system of a box. Exe is a symlink to the init system, but it has quotes in it when you stat the file, which I want to remove. Unfortunately, I've seen the regular apostrophe (U+0027) in exe and right and left single quotation marks (U+2018 and U+2019). It varies between systems. I'm not sure if that is due the shell I'm running and/or its version, if it's the stat utility, or if it's the system itself, I've just seen all three of these characters (sometimes mixed together).Ultimately, I just want to remove all of these characters with the same sed command. So far I've only been able to do it by piping sed to another sed command.This is the entire exe file:$stat /proc/1/exe  File: '/proc/1/exe' -> '/sbin/init'  Size: 0           Blocks: 0          IO Block: 1024   symbolic linkDevice: b9h/185d    Inode: 76948360    Links: 1Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)Access: 2017-02-01 14:52:39.101744022 -0700Modify: 2017-01-25 12:52:20.741244423 -0700Change: 2017-01-25 12:52:20.741244423 -0700 Birth: -Note that in this example it is just the regular apostrophes but I've seen the other quote characters as well. So I start by getting just the content I need:$stat /proc/1/exe | grep File: | awk -F '->' '{print $2}''/sbin/init'Now I want to remove the quotes and the only way I've been able to remove all the different type of quotes is by using multiple sed commands:$stat /proc/1/exe | grep File: | awk -F '->' '{print $2}' | sed 's/\xe2\x80\x98//g' | sed 's/\xe2\x80\x99//g' | sed 's/\x27//g' /sbin/initAfter that I just pipe it to another awk statement:$stat /proc/1/exe | grep File: | awk -F '->' '{print $2}' | sed s'/\xe2\x80\x98//g' | sed 's/\xe2\x80\x99//g' | sed 's/\x27//g' | awk -F '/' '{print $NF}'initI'm aware of /proc/1/comm or just using an ls on /proc/1/exe. The question is how do I combine the three sed commands into one. It should read:If a left quote or right quote or apostrophe exists, remove it. And itshould do this on all occurrences.On a side note, if somebody knows of a better command to get the init system of a box (besides /proc/1/comm as I've seen that be unreliable) or can just make these commands more efficient I'd be interested in learning it.
Remove multiple regular expressions from variable with sed
sed;regular expression;unicode;init