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