Regular expressions in Linux / HPUX
Is there a difference between regular expressions on Linux and on HPUX?
I am using them in sed.
I am trying to accomplish the following, which only works on Linux:
sed -e "s / ^ \ sant \ s $ / # ant / g" Makefile
Now I see that if I remove the '^' then it works on HP too. As I understand it, this should be supported by both.
Where do you use them? In sed? In some scripting languages โโ(say perl)? Somewhere else? The question is unclear. You should post your current regex, or better like script / input / output. Anyway \s
, I think it means "spaces" and this is determined by the locale and possibly other factors.
a source to share
The short answer is, "Yes, there may be a difference."
Long answer:
It depends on which version of sed you are using on each machine, not which operating system the computer is running on.
In my experience, I've found that the toolbox (i.e. sed, grep, awk, etc.) installed on similar HP-UX is often inferior to the versions found on most popular Linux distributions.
I am assuming on HP-UX you are using the HP version of sed and you are using GNU sed on Linux. You will also need to find out what the HP version may or may not do and find common ground with your Linux version, or see if the GNU version can be installed somewhere on your HP machine.
As for the specific regex you give, as with any regex task, it would help if you also gave some example text to match and state what you expect the regex to do.
a source to share