Re: display in a tree structure
Janis Papanagnou wrote:
> Vakayil Thobias wrote:
>> I have to display the data from a file in tree structure(ksh).
>> The file format is as follows(first field parent, second field child) :
>>
>> PM01 PM02
>> PM01 PM1A
>> PM02 PM03
>> PM03 PM04
>> PM04 PM05
>> PM04 PM06
>> PM1A PM1B
>> PM1A PM1C
>>
>> The output should be like this :
>> PM01 -- PM02 -- PM03 -- PM04 -- PM05
>> PM06
>> PM01 PM1A -- PM1B
>> PM1C
>>
>
> The above "output" doesn't seem to have a structure that is
> anyhow related to a tree.
I think that should have been perhaps
PM01 -- PM02 -- PM03 -- PM04 -- PM05
+ -- PM06
PM01 -- PM1A -- PM1B
+ -- PM1C
Or some variation thereof.
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
|