Sponsored Content
Top Forums Shell Programming and Scripting Shell output with plot a tree structure. Post 302753283 by DGPickett on Tuesday 8th of January 2013 11:01:30 AM
Old 01-08-2013
Your example is vertical tree graph, but often horizontal is easier, with indent for tree depth.

You could put it in a ksh/bash associative array so you can recall the subtrees in a controlled fashion, key root level has a, key a contains 'b c' and key b has 'd'.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using regular expressions in c shell control structure

i cant get around using regular expressions in if/else statements. it simply doesnt give me the right results. i've tried using switch/case but that is just as sh!tty as well. (pardon my french but im getting frustrated with c shell..only reason why im writing in it is because it's a hwk... (3 Replies)
Discussion started by: ballazrus
3 Replies

2. Shell Programming and Scripting

tree structure of the data

Hello, I have a file of the following information ( first field parent item, second field child item) PM01 PM02 PM01 PM1A PM02 PM03 PM03 PM04 PM03 PM05 PM03 PM06 PM05 PM10 PM1A PM2A PM2A PM3B PM2A PM3C The output should be like this : PM01 PM02 PM03 PM04 ... (2 Replies)
Discussion started by: ThobiasVakayil
2 Replies

3. UNIX for Dummies Questions & Answers

Tree directory structure of Unix to get final node path

Hi, I want to list all the last directories from mentioned base path. for eg: If i have a base path say /base/base1/ How can i get the path till last node in tree like directory structure of unix by applying any command. so that i will get following output. ... (7 Replies)
Discussion started by: Shiv@jad
7 Replies

4. HP-UX

how could I use shell script to determine which CPU structure

how could I use shell script to determine which CPU structure because I found that I compile my program under Itanium base that cannot run on the PA-RISC base but PA-RISC program can run on Itanium base i would like to use shell script to know which CPU structure it is,how could i do thanks (1 Reply)
Discussion started by: alert0919
1 Replies

5. UNIX for Dummies Questions & Answers

Find a tree structure in software modules

I have a list of software funtions in tcl code. Some of these functions call other functions. I want to build a tree structure of all called functions. Right now I list all the functions into a file then read this file so that I can cat each function and grep for EXECUTE (command that calls... (0 Replies)
Discussion started by: MissI
0 Replies

6. UNIX for Dummies Questions & Answers

Commands to create hierarchical tree structure

I am creating a hierarchical tree structure and I was wondering what commands I needed to do that. I have 4 directories and sixteen sub directories and 4 files. Thank you for your help in getting my started in right direction.:confused: (1 Reply)
Discussion started by: GreginNC
1 Replies

7. Shell Programming and Scripting

help need while creating tree structure

Hi Experts, I have table in mysql like below: 'user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `parent_id` varchar(100) NOT NULL, `member_name` varchar(100) NOT NULL, `city` varchar(100) NOT NULL, `member_id` varchar(100) NOT NULL, `password` varchar(100) NOT... (1 Reply)
Discussion started by: naw_deepak
1 Replies

8. Shell Programming and Scripting

How we can create the master file through shell to show the tree structure of the directory?

Can we create the master file that show the whole tree structure of the directory till a particular folder? Database that contains four sub repository Sybase,sql,oracle,mysql and sql and oracle contains two subrepostories Siebel and plsql and each repositories contains three folders... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

9. Shell Programming and Scripting

Shell script to build directory tree and files

Hi all, I'm trying at the moment to write a shell script to build a directory tree and create files within the built directories. I've scoured through sites and text books and I just can't figure out how to go about it. I would assume that I need to use loops of some sort, but I can't seem... (8 Replies)
Discussion started by: Libertad
8 Replies

10. Shell Programming and Scripting

Plot python script output to file

Hi all, I`m trying to generate some plots using a python package named splicegrapher. I have access to a cluster which does not allow X11 forwarding and as a result I get RuntimeError: could not open display error when I use one of the plotting scripts (attached). How do I modify the script... (1 Reply)
Discussion started by: newbie83
1 Replies
TSEARCH(3)						   BSD Library Functions Manual 						TSEARCH(3)

NAME
tsearch, tfind, tdelete, twalk -- manipulate binary search trees SYNOPSIS
#include <search.h> void * tdelete(const void * restrict key, void ** restrict rootp, int (*compar) (const void *, const void *)); void * tfind(const void *key, void * const *rootp, int (*compar) (const void *, const void *)); void * tsearch(const void *key, void **rootp, int (*compar) (const void *, const void *)); void twalk(const void *root, void (*action) (const void *, VISIT, int)); DESCRIPTION
The tdelete(), tfind(), tsearch(), and twalk() functions manage binary search trees based on algorithms T and D from Knuth (6.2.2). The com- parison function passed in by the user has the same style of return values as strcmp(3). The tfind() function searches for the datum matched by the argument key in the binary tree rooted at rootp, returning a pointer to the datum if it is found and NULL if it is not. The tsearch() function is identical to tfind() except that if no match is found, key is inserted into the tree and a pointer to it is returned. If rootp points to a NULL value a new binary search tree is created. The tdelete() function deletes a node from the specified binary search tree and returns a pointer to the parent of the node to be deleted. It takes the same arguments as tfind() and tsearch(). If the node to be deleted is the root of the binary search tree, rootp will be adjusted. The twalk() function walks the binary search tree rooted in root and calls the function action on each node. The action function is called with three arguments: a pointer to the current node, a value from the enum typedef enum { preorder, postorder, endorder, leaf } VISIT; speci- fying the traversal type, and a node level (where level zero is the root of the tree). RETURN VALUES
The tsearch() function returns NULL if allocation of a new node fails (usually due to a lack of free memory). The tfind(), tsearch(), and tdelete() functions return NULL if rootp is NULL or the datum cannot be found. The twalk() function returns no value. SEE ALSO
bsearch(3), hsearch(3), lsearch(3) BSD
June 15, 1997 BSD
All times are GMT -4. The time now is 08:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy