On Tuesday, April 9, 2002, at 09:39 AM, Kristin A. I. wrote:
> I am trying to indent a scroll-thru menu which has been made into a tree
> using the following database query:
> select dept_id, LPAD(' ',2*(Level-1))||dept_name dept_name
> from depts
> start with dept_id = 1
> connect by dept_parent = PRIOR dept_id;
> My problem is that the query uses spaces to indent the list, and spaces
> seem to be automatically removed from the beginnings of items in
> scroll-thru menus. To remedy this, I have decided to replace the spaces
> with underscores. This is where I become confused.
> s/ /_/g replaces even spaces between words in the list;
> s/^(_*) /_/g would require multiple iterations to catch all the spaces...
> Is there a simple way to replace one thing with another in the amount in
> which the first thing appeared? Ex.: 2 spaces becomes 2 underscores, 4
> becomes 4, etc. Thank you for any help.
>
> --
>
> Namaste,
>
> Kristin
>
> "I can no other answer make, but, thanks, and thanks"
> - William Shakespeare
> Twelfth N, Act iii, Sc.3
to replace leading instances of spaces with underscores:
s/^(\s*)/_ x length $1/e;
that is on a single line. end with '/eg' for multiple lines;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]