bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed


From: Stepan Kasal
Subject: Re: sed
Date: Fri, 9 Apr 2004 11:21:29 +0200
User-agent: Mutt/1.4.1i

Hello David,

On Thu, Apr 08, 2004 at 10:54:27AM -0700, address@hidden wrote:
> Thanks for your hints. Unfortunately, when I create a file w/the syntax
> below and run with -f, I get an error message saying 'unterminated "s"
> command'. I am interpreting this to mean that even when I put the multiline
> command in a file, sed chokes when it sees the sed command on multiple
> lines. Any other ideas? sed version is GNU3.02. Thanks for your help.

>              sed -f subsemi.sed input >output

| [ subsemi.sed ]
| s/;/;\
| /g

Perhaps the problem is that the line is delimited by cr-lf and backslash
doesn't escape the whole two-char pair.  Perhaps the file subsemi.sed should
have unix eol (just lf) instead of dos eof.

Another approach would be to use a more complex sed program:

:start
h
s/;.*/;/
t cont
b
:cont
p
g
s/^[^;]*;//
t start

Again, put this into the file subsemi.sed, and run
        sed -f subsemi.sed <input >output

> I opened the file in question in emacs and realized that the problem is
> that the original file was written in a unix editor, and I am looking at it
> in a windows editor. So the cr-lf sequence needs to be changed. Do you know
> of a simple stub program that changes a unix formatted file to windows?

I do it by one of the following commands in unix:

recode /lf../ <infile >outfile
tr -d '\r' <infile >outfile

But I'm afraid it won't help in your case, I don't use DOS.

Have a nice day,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]