OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
[owl-users] sed pattern matching (new-line character)

From: GalaxyMaster (galaxyopenwall.com)
Date: Thu Oct 27 2005 - 10:32:45 CDT


Hello,

I like the sed utility, and I'm regularly use sed in my scripts. The
only one thing there which bother me: the handling of new-line character
in RE pattern. According to the sed(1) manual page:

                                                  The \n sequence
       in a regular expression matches the newline character, and
       similarly for \a, \t, and other sequences.

I'm using the latest sed available on Owl:
jill!galaxy:~$ rpm -q sed
sed-4.1.1-owl1

Now, my session script to show the problem:
jill!galaxy:~$ cat sed-test.txt
line 1
line 2
line 3
jill!galaxy:~$ cat sed-test.txt | sed 's,\n,,g'
line 1
line 2
line 3
jill!galaxy:~$ cat sed-test.txt | tr -d '\n'
line 1line 2line 3jill!galaxy:~$

The last two commands should produce the equivalent output, but they
don't :(. What I'm missing? It seems like a real bug in sed's code.
I've tested versions from 3.02 to 4.1.1, all of them have this issue.
This issue isn't Owl-related, RHEL is also has it.

--
(GM)