Help with a regular expression???

accessys at smart.net accessys at smart.net
Wed Jan 27 19:22:48 UTC 2010



no only has to be 5ft in one direction. and a stairway landing does not 
need to meet the 5ft landing anyway that is for ramps.

sorry misunderstood the question
Bob



On Wed, 27 Jan 2010, Ray Parrish wrote:

> Date: Wed, 27 Jan 2010 11:07:02 -0800
> From: Ray Parrish <crp at cmc.net>
> Reply-To: "Ubuntu user technical support, not for general discussions"
>     <ubuntu-users at lists.ubuntu.com>
> To: "Ubuntu user technical support, not for general discussions"
>     <ubuntu-users at lists.ubuntu.com>
> Subject: Re: Help with a regular expression???
> 
> James Michael Fultz wrote:
>> * James Michael Fultz <croooow at gmail.com> [2010-01-27 13:04 -0500]:
>>
>>> * Ray Parrish <crp at cmc.net> [2010-01-27 09:04 -0800]:
>>>
>>>> Amedee Van Gasse (ub) wrote:
>>>>
>>> [...]
>>>
>>>>> The same regex syntax can be used with the bash command sed:
>>>>>
>>>>> sed 's/    ([^ ])/_ \1/g'
>>>>>
>>> [...]
>>>
>>>> DescriptionSection=`echo | sed 's/    ([^ ])/_ \1/g'`
>>>> echo "$DescriptionSection"
>>>>
>>>> And I get the following cryptic error, which tells me nothing. Can you help?
>>>>
>>>> sed: -e expression #1, char 19: invalid reference \1 on `s' command's RHS
>>>>
>>> DescriptionSection=`echo | sed 's/    \([^ ]\)/_ \1/g'`
>>>
>> [...]
>>
>> Oops!  Overlooked one other thing.
>>
>> DescriptionSection=`echo "$SomeVar" | sed 's/    \([^ ]\)/_ \1/g'`
>>
>> Where '$SomeVar' is a variable whose contents you wish to process.
>> Also, the following form using printf is actually safer.
>>
>> DescriptionSection=`printf '%s\n' "$SomeVar" | sed 's/    \([^ ]\)/_ \1/g'`
>>
>> The reason printf is safer than echo being that printf ignores
>> subsequent options (strings starting with a dash), whereas echo may
>> misinterpret an arbitrary string beginning with a dash as an option.
>>
> Hello again,
>
> That has gotten it perfectly now. Thank you! I have the following code -
>
> DescriptionSection="  - Multidimensional Array Objects
>    * Efficient arrays of homogeneous machine types (floats, longs,
>    complex doubles)
>    * Arbitrary number of dimensions
>      line continuation.
>    * Sophisticated structural operations
>  - Universal Function Objects
>    * Support mathematical functions on all Python objects
>    - Very efficient for array objects"
> DescriptionSection=`echo "$DescriptionSection" | sed 's/      \([^
> \*-]\)/_ \1/g'`
> DescriptionSection=`echo "$DescriptionSection" | sed 's/    \([^
> \*-]\)/_ \1/g'`
> echo "$DescriptionSection"
>
> Which outputs -
>
>  - Multidimensional Array Objects
>    * Efficient arrays of homogeneous machine types (floats, longs,
> _ complex doubles)
>    * Arbitrary number of dimensions
> _ line continuation.
>    * Sophisticated structural operations
>  - Universal Function Objects
>    * Support mathematical functions on all Python objects
>    - Very efficient for array objects
>
> Now I can finally run my other code over the DescriptionSection variable
> to format it's text lists into HTML lists.
>
> Later, Ray Parrish
>
>
> --
> Linux dpkg Software Report script set..
> http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
> Ray's Links, a variety of links to usefull things, and articles by Ray.
> http://www.rayslinks.com
> Writings of "The" Schizophrenic, what it's like to be a schizo, and other
> things, including my poetry.
> http://www.writingsoftheschizophrenic.com
>
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>




More information about the ubuntu-users mailing list