sed-devel
[Top][All Lists]
Advanced

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

A question of multiple "-e" commands in one command line.


From: George R Goffe
Subject: A question of multiple "-e" commands in one command line.
Date: Sat, 16 Nov 2019 01:24:03 +0000 (UTC)

Hi,

I'm hoping that this question is sent to the "right" forum.

I use sed to edit html files. I perform multiple actions on these files. When I 
string the "-e" commands together I get a different result from when I string 2 
"-e" sets. I'm a little confused due to my lack of regex and sed experience.

Here's the script I'm attempting to run. Case 1 has separate sed commands. Case 
2 has all the "-e" commands in one command. The results appear to be different.

sed --posix -E -i -e 's@  *@ @g' -e 's@\n@@' -e 's@\r@@' -e 's@>@>\r\n @g' -e 
'/^$/d' -e '/^ $/d' file1

sed --posix -E -i -e 's@  *@ @g' -e 's@\n@@' -e 's@\r@@' -e 's@>@>\r\n @g' file2
sed --posix -E -i -e '/^$/d' -e '/^ $/d' file2

diff file1 file2
1 1a2
2 > 
3 2a4
4 > 
5 3a6
6 > 
7 4a8

Thanks for your time AND your patience.

George...


reply via email to

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