Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Oct 2005 19:32:45 +0400
From: "(GalaxyMaster)" <>
Subject: sed pattern matching (new-line character)


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

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.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.