| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
if only the postcode has 5 digits, it seems fairly easy:
sed -r 's|[0-9]{5} |; &; |'
On 20/05/17 20:01, Christopher Stone [email protected]
[sed-users] wrote:
> On 05/20/2017, at 12:08, Rachid Mokrani <[email protected]> wrote:
>> I can not find a simple sed command that will allow me to do this.
>>
>> echo "221b Baker St, Marylebone, 32861 London"
>>
>> TO:
>>
>> 221b Baker St, Marylebone, ; 32861 ; London
> ______________________________________________________________________
>
> Hey Rachid,
>
> If your version of sed supports word-boundaries then this is simple:
>
> ---------------------------------------------------
>
> #!/usr/bin/env bash
>
> strVar='221b Baker St, Marylebone, 32861 London'
>
> gsed -r 's!\b([0-9]{5})\b! ; \1 ; !' <<< "$strVar"
>
> ---------------------------------------------------
>
> If it doesn't then please tell us what OS and what version of sed you're using.
>
> --
> Best Regards,
> Chris
>
>
>
> ------------------------------------
> Posted by: Christopher Stone <[email protected]>
> ------------------------------------
>
------------------------------------
------------------------------------
--
------------------------------------
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/