sed with PCRE (like grep -P)
up vote
2
down vote
favorite
I am happy that grep
does support Python Compatiable Regular Expressions with the -P
option.
Is there a reason why the tool sed
does not have this feature?
sed regex
add a comment |
up vote
2
down vote
favorite
I am happy that grep
does support Python Compatiable Regular Expressions with the -P
option.
Is there a reason why the tool sed
does not have this feature?
sed regex
6
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am happy that grep
does support Python Compatiable Regular Expressions with the -P
option.
Is there a reason why the tool sed
does not have this feature?
sed regex
I am happy that grep
does support Python Compatiable Regular Expressions with the -P
option.
Is there a reason why the tool sed
does not have this feature?
sed regex
sed regex
edited Jun 29 at 16:14
muru
135k19288488
135k19288488
asked Jun 29 at 11:32
guettli
65042063
65042063
6
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41
add a comment |
6
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41
6
6
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
See GNU bug report logs - #22801
status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use perl
itself for many of the simple one-liners for which you might want to use PCRE in sed
.
add a comment |
up vote
0
down vote
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
perl -pe 's/../../g' file
or inline replace:
perl -pie 's/../../g' file
This works for the cases where I use sed
. If things get more complicated I write a small python script.
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
The most promising thing I found after a quick search iss2p
(sed to Perl), though I just tried it and the output was VERY verbose.
– wjandrea
Nov 26 at 16:00
1
@wjandrea I updated the answer: "This works for the cases where I usesed
. If things get more complicated I write a small python script."
– guettli
Nov 27 at 8:06
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
See GNU bug report logs - #22801
status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use perl
itself for many of the simple one-liners for which you might want to use PCRE in sed
.
add a comment |
up vote
4
down vote
In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
See GNU bug report logs - #22801
status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use perl
itself for many of the simple one-liners for which you might want to use PCRE in sed
.
add a comment |
up vote
4
down vote
up vote
4
down vote
In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
See GNU bug report logs - #22801
status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use perl
itself for many of the simple one-liners for which you might want to use PCRE in sed
.
In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
See GNU bug report logs - #22801
status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use perl
itself for many of the simple one-liners for which you might want to use PCRE in sed
.
answered Jun 29 at 11:43
steeldriver
65.1k11104176
65.1k11104176
add a comment |
add a comment |
up vote
0
down vote
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
perl -pe 's/../../g' file
or inline replace:
perl -pie 's/../../g' file
This works for the cases where I use sed
. If things get more complicated I write a small python script.
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
The most promising thing I found after a quick search iss2p
(sed to Perl), though I just tried it and the output was VERY verbose.
– wjandrea
Nov 26 at 16:00
1
@wjandrea I updated the answer: "This works for the cases where I usesed
. If things get more complicated I write a small python script."
– guettli
Nov 27 at 8:06
add a comment |
up vote
0
down vote
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
perl -pe 's/../../g' file
or inline replace:
perl -pie 's/../../g' file
This works for the cases where I use sed
. If things get more complicated I write a small python script.
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
The most promising thing I found after a quick search iss2p
(sed to Perl), though I just tried it and the output was VERY verbose.
– wjandrea
Nov 26 at 16:00
1
@wjandrea I updated the answer: "This works for the cases where I usesed
. If things get more complicated I write a small python script."
– guettli
Nov 27 at 8:06
add a comment |
up vote
0
down vote
up vote
0
down vote
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
perl -pe 's/../../g' file
or inline replace:
perl -pie 's/../../g' file
This works for the cases where I use sed
. If things get more complicated I write a small python script.
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
perl -pe 's/../../g' file
or inline replace:
perl -pie 's/../../g' file
This works for the cases where I use sed
. If things get more complicated I write a small python script.
edited Nov 27 at 8:05
answered Nov 26 at 15:30
guettli
65042063
65042063
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
The most promising thing I found after a quick search iss2p
(sed to Perl), though I just tried it and the output was VERY verbose.
– wjandrea
Nov 26 at 16:00
1
@wjandrea I updated the answer: "This works for the cases where I usesed
. If things get more complicated I write a small python script."
– guettli
Nov 27 at 8:06
add a comment |
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
The most promising thing I found after a quick search iss2p
(sed to Perl), though I just tried it and the output was VERY verbose.
– wjandrea
Nov 26 at 16:00
1
@wjandrea I updated the answer: "This works for the cases where I usesed
. If things get more complicated I write a small python script."
– guettli
Nov 27 at 8:06
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example
/delete this line/ d
– wjandrea
Nov 26 at 15:34
Well that's great for substitution, but how would you do other sed stuff in Perl? like for example
/delete this line/ d
– wjandrea
Nov 26 at 15:34
1
1
The most promising thing I found after a quick search is
s2p
(sed to Perl), though I just tried it and the output was VERY verbose.– wjandrea
Nov 26 at 16:00
The most promising thing I found after a quick search is
s2p
(sed to Perl), though I just tried it and the output was VERY verbose.– wjandrea
Nov 26 at 16:00
1
1
@wjandrea I updated the answer: "This works for the cases where I use
sed
. If things get more complicated I write a small python script."– guettli
Nov 27 at 8:06
@wjandrea I updated the answer: "This works for the cases where I use
sed
. If things get more complicated I write a small python script."– guettli
Nov 27 at 8:06
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1050693%2fsed-with-pcre-like-grep-p%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6
It's Perl Compatible Regular Expressions though... ;-)
– Byte Commander
Jun 29 at 11:39
Same question from 2012 on the Mailing List
– RoVo
Jun 29 at 11:41