-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintTable.awk
More file actions
37 lines (32 loc) · 1.04 KB
/
Copy pathprintTable.awk
File metadata and controls
37 lines (32 loc) · 1.04 KB
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
BEGIN {
FS=";"
printf "%s \n", "+-------+------------------+----------------+"
printf "|%-6s |%-18s| %-15s|\n", " Host ", " IP Address ", "System"
printf "%s \n", "+-------+------------------+----------------+"
vindex=0
vsuma_salarios=0
}
{
vindex++
datos[vindex]["ip"] = $1
datos[vindex]["system"] = $2
}
END {
for (i = 1; i <= vindex; i++){
for (j = 1; j <= vindex-1; j++) {
if (datos[j]["ip"] > datos[j+1]["ip"]){
c1 = datos[j+1]["ip"]
c2 = datos[j+1]["system"]
datos[j+1]["ip"] = datos[j]["ip"]
datos[j+1]["system"] = datos[j]["system"]
datos[j]["ip"] = c1
datos[j]["system"] = c2
}
}
}
for (i = 1; i<=vindex; i++) {
printf "| %-5s | %-17s| %-15s|\n", i, datos[i]["ip"], datos[i]["system"]
}
printf "%s \n", "+-------+------------------+----------------+"
print VPIE
}