forked from ipsorakis/GeneralNetworkTools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
analyse_scripts.m
58 lines (40 loc) · 1.14 KB
/
analyse_scripts.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function [A scripts] = analyse_scripts(target_directory,output_filename)
command = ['ls -LR ',target_directory,' | grep .m$'];
[r w] = unix(command);
scripts = strsplit(w,char(10));
total_scripts = length(scripts);
for i=1:total_scripts
filename = strsplit(scripts{i},'.');
scripts{i} = filename{1};
end
A = zeros(total_scripts);
%$ find / -name httpd.conf
% grep [string] file
for i=1:total_scripts
100*i/total_scripts
scripts{i}
curr = scripts{i};
if strfind(curr,'NMF_testspace')
continue;
end
[r filepath] = unix(['find ',target_directory,' -name ',curr,'.m']);
if r == 0
for j=1:total_scripts
if i~=j
[r w] = unix(['grep ',scripts{j},'\( ',filepath]);
if r==0
A(i,j) = ~isempty(w);
if A(i,j)
scripts{j}
curr
end
end
end
end
end
disp('----');
end
if exist('output_filename','var')
export_GML(A,output_filename,scripts);
end
end