last day (14 days later) » 

07:08
4
A: What the equivalent of "grep | cut" using sed or awk?

Stéphane ChazelasThe exact equivalent would be something like: sed -n '/email2/{s/^[^=]*=\([^=]*\).*/\1/;p;}' < file But you'd probably want instead: sed -n 's/^[^=]*email2[^=]*=[[:blank:]]*//p' < file (that is match email2 only on the part before the first = and return everything on the right of the first ...

Is space required between { s?
Yes, that's exactly I have stucked when working with this. After re-reading POSIX sed documentation, I see ;} is an accepted extension, but it's not required. It's strange that GNU sed with --posix option still allow {command} form. Do you think it's a bug?
I can't find where ;} is mentioned in the Sed POSIX specs as an accepted extension. It seems to be required by The <right-brace> shall be preceded by a <newline> or <semicolon>. @cuonglm or Stephane, could you clarify?
@Wildcard Yes, ;} is not POSIX, that what Stephane said in his comment above. But I remember it will be in next POSIX version, there's an issue in austin bug group.
@cuonglm, no, I mean I don't see it as just an extension. "The right brace shall be preceded by a newline or semicolon...." So if you precede it with a semicolon in your Sed script, haven't you followed the explicit instructions of POSIX?
@cuonglm, huh, I still don't see it in the specs. But if it will be changed in the next POSIX edition I suppose it's not critical. :)
@Wildcard: The austinbug group link austingroupbugs.net/view.php?id=961
@Wildcard Ops, look like the spec was changed follow that issue.
07:10
@cuonglm Now I'm even more confused. The only POSIX specs for Sed that I am aware of are here, and they have the older version of the line that is specified in that link you just gave. Is there a later version I'm not aware of?
Hmm, that's the newest one
@cuonglm From this link it looks like the change being discussed (and relaxed) is the requirement that a newline follow the }, not that a newline precede the }.
@cuonglm Well at least that's clear. "The right brace shall be preceded by a newline."
Yes, and even in the newer version as the link you gave, I remember ;} isn't allowed
I think they made the change after that issue accepted
07:16
@cuonglm No, ;} is explicitly allowed: The <right-brace> shall be preceded by a <newline> or <semicolon>. But it seems that what is not allowed is ;};} because Editing commands other than {...}, a, b, c, i, r, t, w, :, and # can be followed by a <semicolon>, optional <blank> characters, and another editing command.
That seems to be the requirement discussed in the link you gave.
@cuonglm Does that mean the change has been made, but the current issue of POSIX doesn't include it? So the next one will, for sure?
(How does that work?)
@Wildcard See this issue by Stephane austingroupbugs.net/view.php?id=944
and his comment
The only sensible explanation is a whole command group ({ to the matching }). As in {...;} cannot be followed by ;, but then again all implementations I tested including Unix V7 allow:

sed '{=;};{=;}'
@cuonglm That's very very helpful, thanks! :)
What I really meant was how do the issues of POSIX work, since the issue you linked earlier is marked "resolved" but the proposed change doesn't appear in the current Sed specs.
I think it does
Ah
sorry, it doesn't, as it's tagged issue 8
also, its status is resolved, not approved :D
@cuonglm But the resolution is "Accepted"....
yes, it's accepted to be included in new version, but not yet
because new version isn't there
current POSIX issue is 7
next will be 8
Anyway, I remember the question how austinbug group issue process was asked somewhere
let me check
07:33
@cuonglm Aha. Is version 8 visible somewhere (i.e. the currently accepted content for what will be version 8)?
@Wildcard AFAIK, no. You must search the austingroup bug site, with tag filter issue 8
And am I right in thinking this is a public tracking system, and I could create an account and open an issue if I so chose? (After searching for existing issues, considering implications, etc., etc.)
@cuonglm Got it, thanks.
yes, that's it
@cuonglm Wow, nice.
I see mention of a "conference call" in a random ticket I am reading.
Is there a doc somewhere that covers the working of the POSIX specifications group itself? Like, who puts issue 8 together from the various tickets, and who decides when it gets released? How would I end up on these conference calls?
There's FAQ for those questions
I don't remember all, but I only know geoffclare and ajosey often accept and approve isses
and it's interesting that you will see many reporters who are in U&L
Stephane, Schily, Thomas Dickey ...
their issues and discussions are very useful
07:39
@cuonglm Awesome!
@cuonglm Not surprised at all.
:)
I've made it a habit for a long time now to check POSIX specs before I check man pages.
yep, mee too :+1:
Well, I have to go now, but I really appreciate you taking the time. :) Thanks!
No problem :)

last day (14 days later) »