Find a tree structure in software modules

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find a tree structure in software modules
# 1  
Old 11-11-2009
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 another function) within each function.

cat fileNameFunctions |xargs -1| while FUNC

Using sed several times, I clean up the output until all I have is 2 columns. The first is the calling function and the second is the called function. one line for each time a function is called. I generate a file called INPUT that looks like this (without comments):

A B (A calls B 3 times within the A function)
D E (D calls both E and F within the D function)

I would eventually like to create a file that contains:

A B L (A calls B calls L)
C D E (C calls D calls E)
C D F P (C calls D calls F calls P )
(notice that this is expanded from the one above because D calls 2 functions)

I can collapse the ouput file above by importing within excel and doing a unique sort.

I just want to get a file that has all the called functions starting with my primary functions (first column)

Now I want to generate a further list of secondary called functions. I have done something like this. ( INPUT1 = INPUT = INPUT2)

cat INPUT |xargs -n 2| while read FUNCA FUNCB
cat INPUT1 |xargs -n 2| while read FUNC1 FUNC2
cat INPUT2 |xargs -n 2| while read FUNC3 FUNC4
if($FUNCB == FUNC3 ) then
echo "$FUNC1 \t$FUNC2 \tFUNC4" >> OUTPUT

I think the logic will work, but the 'if statement' does nothing. What is wrong with my if statement?
Also, can anyone think of a cleaner way to do this? I can iterate the logic above and get the job done so it is secondary.
Sorry, am a newbi and don't know perl or anything beside unix scripts, and only a few of those, as you seeSmilie.

Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Software Suite Structure

E have the following directory structure for my programs executables are put in bin, object files in obj There is a makefile .mk for each program. I would need to have another makefile to build everything called Makefile. Unsure if I should keep all makefiles where they are op put them in... (1 Reply)
Discussion started by: kristinu
1 Replies

2. Shell Programming and Scripting

Shell output with plot a tree structure.

Hi All, i am in need of plotting graph ( tree structure ) depends upon my shell script output. For this requirement, what kind of open source avail in market. For example: (my script output will be like below ) Parent:A process-name:child-processes A:B,C B: D expecting... (1 Reply)
Discussion started by: ponmuthu
1 Replies

3. Shell Programming and Scripting

how to create custom modules in perl and how to import all modules with single command?

I have some custom functions which i want to use in perl Scripting all time. i want to How to create modules in perl and how to import them. Also if i create 15 modules and i want to > import all at once then how can i import? (0 Replies)
Discussion started by: Navrattan Bansa
0 Replies

4. 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

5. 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

6. Shell Programming and Scripting

How to find which perl modules version is used?

Hi All, I am rather new to the world of Perl programming. I have a question regarding the perl modules. I have a linux box running slackware 12.2 and has perl installed by default there (version 5.10.0) and it has several modules installed namely DBI and DBD::mysql that I wanted to upgrade. ... (2 Replies)
Discussion started by: aherrys
2 Replies

7. 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

8. 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

9. 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

10. UNIX for Advanced & Expert Users

find my tree of processes

Hi. I am logging into a remote unix/linux server (of any kind - aix, hpux, linux...) I would like to run a shell command that will return me the list of PIDs that relate to my tree. I need to get the PID of my father, and my self. I know that my SSHD process openes a BASH process. need both... (2 Replies)
Discussion started by: yamsin789
2 Replies
Login or Register to Ask a Question