CompuServe Thread

Forum unknown · Programming

#ARP again!

13 messages in this thread
#117081From: Don Curtis/SYSOPApr 2, 1988 12:17 AM
Yes, using 'regular expressions' (for those who don't know, grep stands for General Regular Expression Parser) there are several options: ? = zero or one occurance + = one or more occurances . = any one character * = 0 or more occurances of the preceding character eg: /a?x/ matches 'x' and 'ax' /a+x/ matches 'ax', 'aax', 'aaaax' and so on /a.x/ matches 'aax', 'abx', 'acx' and so on /a*x/ matches 'x', 'ax', 'aax', 'aaax' and so on Don
#117124From: Peter da SilvaApr 2, 1988 12:22 PM
GREP actually stands for "Global Regular Expression Print", because that's what you type in the UNIX editor (ed) to do what grep does: g/re/p where re is the regular expression. There used to also be a "gres", "Global Regular Expression Substitute", once again based on the UNIX ed command: g/re/s which you follow by the substitute pattern, like so: g/re/s//replacement/ but it got left out of Version 7 and subsequent versions because it was replaced by the Stream Editor, "sed", which gave you the ability to perform all the editor commands in a stream fashion: sed '/re/s//replacement/'. Perhaps someone who has more free time than I could take the PD grep source and put in a substitute option. There is also a PD version of the unix ED editor available, in 'C'. I keep it around. If it hasn't been uploaded yet I might be persuaded to arc my copy up.
#117189From: Don Curtis/SYSOPApr 3, 1988 12:39 AM
Well…I'll defer to you, but that's not the way I heard it. I'll have to take a look in my AT&T manuals when I get to work tommorow. But, yes, :g/string/s//replacement/ works fine with ed or vi, etc. I use it all the time.
#117231From: Peter da SilvaApr 3, 1988 11:09 AM
They stripped a lot of neat stuff out of the manuals over the years, especially etymological notes like that.
#117388From: Don Curtis/SYSOPApr 4, 1988 1:56 AM
Since you prompted my curiosity, I checked my UNIX manuals (both the 'store bought AT&T' manuals and the looseleaf manuals that came with our 3B2-600's)…you're right, it is Global Regular Expression Printer. It's still in the manuals…but in an obscure spot.
#117388From: Don Curtis/SYSOPApr 4, 1988 1:56 AM
Since you prompted my curiosity, I checked my UNIX manuals (both the 'store bought AT&T' manuals and the looseleaf manuals that came with our 3B2-600's)…you're right, it is Global Regular Expression Printer. It's still in the manuals…but in an obscure spot.
#117231From: Peter da SilvaApr 3, 1988 11:09 AM
They stripped a lot of neat stuff out of the manuals over the years, especially etymological notes like that.
#117189From: Don Curtis/SYSOPApr 3, 1988 12:39 AM
Well…I'll defer to you, but that's not the way I heard it. I'll have to take a look in my AT&T manuals when I get to work tommorow. But, yes, :g/string/s//replacement/ works fine with ed or vi, etc. I use it all the time.
#117124From: Peter da SilvaApr 2, 1988 12:22 PM
GREP actually stands for "Global Regular Expression Print", because that's what you type in the UNIX editor (ed) to do what grep does: g/re/p where re is the regular expression. There used to also be a "gres", "Global Regular Expression Substitute", once again based on the UNIX ed command: g/re/s which you follow by the substitute pattern, like so: g/re/s//replacement/ but it got left out of Version 7 and subsequent versions because it was replaced by the Stream Editor, "sed", which gave you the ability to perform all the editor commands in a stream fashion: sed '/re/s//replacement/'. Perhaps someone who has more free time than I could take the PD grep source and put in a substitute option. There is also a PD version of the unix ED editor available, in 'C'. I keep it around. If it hasn't been uploaded yet I might be persuaded to arc my copy up.
#117164From: John DraperApr 3, 1988 12:01 AM
Well, you were close… grep comes from Global/Regular Expression/Print, which is from some editor or another, and seen there in the form: g/<regular experssion>/p
#117164From: John DraperApr 3, 1988 12:01 AM
Well, you were close… grep comes from Global/Regular Expression/Print, which is from some editor or another, and seen there in the form: g/<regular experssion>/p
#117213From: BILL LEACHApr 3, 1988 7:25 AM
Thanks Don, I was sure that you can create just about any pattern and sepecify both limited and unlimited options. 73, bill
#117213From: BILL LEACHApr 3, 1988 7:25 AM
Thanks Don, I was sure that you can create just about any pattern and sepecify both limited and unlimited options. 73, bill