Files
Pyro57000 941e40e798 Create parse_netview.fish
little fish script to parse a netview output file with multiple server entries.
2024-11-21 13:01:13 -06:00

38 lines
1.2 KiB
Fish

function parse_netview
echo "
@@@@@@@@@
%---------#@
%-----------+++++++++++*@
%+=::-----------------+*%
%+- .=*-:::::::-%
@%#**********-:::::::::-%
%::::::::::::::::::::::-%
%::::::::::::::::::::::-%
%::::::::::::::::::::::-%
%::::::::::::::::::::::-%
%::::::::::::::::::::::-%
%::::::::::::::::::::::-%
@@@@@@@@@@@@@@@@@@@@@@@@
"
if test (count $argv) -ne 2
echo Usage parse_netview /path/to/netview/output /path/to/save/parsed/data
return 1
end
set server ""
set share ""
for line in $(cat $argv[1])
if string match -q -- "*Shared resources at*" "$line"
set server $(string escape -- $(echo $line | cut -d " " -f 4 | cut -d "\\" -f 3))
end
if string match -q -- "*Disk*" "$line"
set share $(string escape -- $(echo $line | cut -d " " -f 1))
set combined "\\\\$server$share"
set cleaned (string replace -a "'" "" $combined)
set outline (string replace -a \\r \\ $cleaned)
echo -n " " \r
echo -n $outline \r
echo $outline >> $argv[2]
end
end
end