| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
On 22/03/16 09:11, Thierry Blanc [email protected] [sed-users] wrote:
now access to full keyboard.
/^Name:/!b
# if line starts with Name: don't branch to end
:a
/\*,/bb
# if line containts '*,' all letters up to comma have been replaced by
'*' so branch to b
s/[^, *]/*/
# substitute next letter (that is not comma, space or asterix)
ba
:b
s/^...../Name:/
# put the beginning of line back in place
> :a
> /\*,/bb
> s/[A-Za-z]/*/
> ta
> :b
> s/^...../Name:/
>
> What about a name like Bart J. Simpson?
>
> Tested on sedroid
>
>
> On March 20, 2016 4:52:33 PM CET, "'Brian J. Murrell' [email protected] [sed-users]" <[email protected]> wrote:
>> Let's say I have a file of lines and some of the lines are of the form:
>>
>>
>> Name: <a first name> <possibly attributions like M.D.>
>>
>>
>> Such as:
>>
>>
>> Name: Bart Simpson, MD
>>
>>
>> and I want to redact the name part only with a 1:1 substitution of
>> letters to asterisks so that the result is:
>>
>>
>> Name: **** *******, MD
>>
>>
>> So effectively I want to do a 's/[A-Za-z]/*/g' only on the portion of
>> the line that comes after the ": " and before any ,.
>>
>>
>> Is there any way to do this with sed?
>>
>>
>> Cheers,
>> b.
>>
>>
>>
>>
>> [Non-text portions of this message have been removed]
>>
>>
>>
>>
>> ------------------------------------
>> Posted by: "Brian J. Murrell" <[email protected]>
>> ------------------------------------
>>
>> --
>>
>> ------------------------------------
>>
>> Yahoo Groups Links
>>
>>
>>
------------------------------------
------------------------------------
--
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/sed-users/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/