Skip to content

Portability fix: Avoid the use of sed -r#62

Open
fumiyas wants to merge 1 commit intobruceg:masterfrom
fumiyas:rts.sed-portability
Open

Portability fix: Avoid the use of sed -r#62
fumiyas wants to merge 1 commit intobruceg:masterfrom
fumiyas:rts.sed-portability

Conversation

@fumiyas
Copy link
Copy Markdown
Contributor

@fumiyas fumiyas commented Jun 28, 2019

Legacy sed does not support -r option (use extended regular expressions)

Legacy sed does not support -r option (use extended regular expressions)
@schmonz
Copy link
Copy Markdown

schmonz commented Jan 25, 2020

Another option: according to GNU sed's manpage, -E is the POSIX-specified and portable synonym for -r. This seems to work for me on a bunch of platforms:

@@ -20,8 +20,8 @@ svpid=$!
 waitok test.sv

 svstat test.sv \
-| sed -r 's, \(.+\),,' \
-| sed -r 's, ([0-9]|1[0-9]) second.+$, ok,'
+| sed -E 's, \(.+\),,' \
+| sed -E 's, ([0-9]|1[0-9]) second.+$, ok,'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants