[GRASS-dev] g.mlist problem
Michael Barton
michael.barton at asu.edu
Tue Sep 18 11:41:20 EDT 2007
Thanks again William.
Can others test on different platforms and let us know before I commit
something that breaks it for other people?
Michael
On 9/18/07 8:37 AM, "William Kyngesburye" <woklist at kyngchaos.com> wrote:
> It should be. I checked the Gnu sed docs online, and they also say
> that you must use \ + real newline in the replacement string. I
> wonder why \n works for other platforms?
>
> On Sep 18, 2007, at 10:04 AM, Michael Barton wrote:
>
>> William,
>>
>> I'm very glad you've identified the problem. But I worry whether this
>> solution is portable across platforms.
>>
>> Michael
>>
>>
>> On 9/18/07 6:47 AM, "William Kyngesburye" <woklist at kyngchaos.com>
>> wrote:
>>
>>> Same happens for me (OSX). I walked thru the script commands
>>> manually, and it is indeed messing up on the first sed.
>>>
>>> I see this in the sed man for Sed Regex info (OSX uses the BSD sed):
>>>
>>> 2. The escape sequence \n matches a newline character embedded
>>> in the
>>> pattern space. You can't, however, use a literal newline
>>> character
>>> in an address or in the substitute command.
>>>
>>> Later, for the s/ function, it says:
>>>
>>> A line can be split by substituting a newline character into it.
>>> To specify a newline character in the replacement string, precede
>>> it with a backslash.
>>>
>>> Putting a real newline after the \ does the trick:
>>>
>>> g.list type=$type mapset=$mapset \
>>> | grep -v '^-\+$' \
>>> | grep -v "files available" \
>>> | grep -vi "mapset" \
>>> | sed 's/ */\
>>> /g' \
>>> | grep -v '^$' \
>>> | grep "$search" \
>>> | sort \
>>> | sed -e "s/$/$MAPSET/"
>>>
>
> -----
> William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
> http://www.kyngchaos.com/
>
> All generalizations are dangerous, even this one.
>
>
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
More information about the grass-dev
mailing list