You just have to look at the column headers, then match using (simple) regular expressions for the egrep.
Let's dissect it:
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 993)-> esxtopBatchFile=foo.csv
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 994)-> head -1 ${esxtopBatchFile} | tr ',' '\n' | nl | sed -e 's/^[[:space:]]*//' | sed -r 's/\s+/,/;' | wc -l
40886
There are 40886 possible lines, a bit much to read through so you might want to "grep -i" for stuff that you care about, note that some of the counters have different names in esxtop batch compared to live esxtop. Let's understand that line though:
head -1 will return the first line of the csv, i.e. the column headers, all other lines (rows) are values
tr will "translate" commas to newlines, i.e. making rows out of the columns
nl will add a line number count in front of the line
the first sed will remove multiple white spaces before the line numbers
the second sed will change the first white space after the numbers to a single comma
etc.
You can discover all of that by just manually stepping through the script (use a head in the end to only look at 10 rows instead of thousands):
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 995)-> head -1 ${esxtopBatchFile} | tr ',' '\n' | nl | sed -e 's/^[[:space:]]*//' | sed -r 's/\s+/,/;' | grep "Virtual Disk" | head
32268,"\\hostname.domain.tld\Virtual Disk(VMNAME)\FailedIOs"
32269,"\\hostname.domain.tld\Virtual Disk(VMNAME)\TotalIOs"
32270,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Latency"
32271,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Commands/sec"
32272,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Reads/sec"
32273,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Writes/sec"
32274,"\\hostname.domain.tld\Virtual Disk(VMNAME)\MBytes Read/sec"
32275,"\\hostname.domain.tld\Virtual Disk(VMNAME)\MBytes Written/sec"
32276,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Average MilliSec/Read"
32277,"\\hostname.domain.tld\Virtual Disk(VMNAME)\Average MilliSec/Write"
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 996)-> head -1 ${esxtopBatchFile} | tr ',' '\n' | nl | head # sed -e 's/^[[:space:]]*//' | sed -r 's/\s+/,/;' | grep "Virtual Disk"
1 "(PDH-CSV 4.0) (UTC)(0)"
2 "\\hostname.domain.tld\Memory\Memory Overcommit (1 Minute Avg)"
3 "\\hostname.domain.tld\Memory\Memory Overcommit (5 Minute Avg)"
4 "\\hostname.domain.tld\Memory\Memory Overcommit (15 Minute Avg)"
5 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (1 Minute Avg)"
6 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (5 Minute Avg)"
7 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (15 Minute Avg)"
8 "\\hostname.domain.tld\Physical Cpu(0)\% Processor Time"
9 "\\hostname.domain.tld\Physical Cpu(1)\% Processor Time"
10 "\\hostname.domain.tld\Physical Cpu(2)\% Processor Time"
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 997)-> head -1 ${esxtopBatchFile} | tr ',' '\n' | nl | sed -e 's/^[[:space:]]*//' | head # sed -r 's/\s+/,/;' | grep "Virtual Disk"
1 "(PDH-CSV 4.0) (UTC)(0)"
2 "\\hostname.domain.tld\Memory\Memory Overcommit (1 Minute Avg)"
3 "\\hostname.domain.tld\Memory\Memory Overcommit (5 Minute Avg)"
4 "\\hostname.domain.tld\Memory\Memory Overcommit (15 Minute Avg)"
5 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (1 Minute Avg)"
6 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (5 Minute Avg)"
7 "\\hostname.domain.tld\Physical Cpu Load\Cpu Load (15 Minute Avg)"
8 "\\hostname.domain.tld\Physical Cpu(0)\% Processor Time"
9 "\\hostname.domain.tld\Physical Cpu(1)\% Processor Time"
10 "\\hostname.domain.tld\Physical Cpu(2)\% Processor Time"
(vbondzio)-(jobs:0)-(~/batch_script_tmp)
(! 998)-> head -1 ${esxtopBatchFile} | tr ',' '\n' | nl | sed -e 's/^[[:space:]]*//' | sed -r 's/\s+/,/;' | head # grep "Virtual Disk"
1,"(PDH-CSV 4.0) (UTC)(0)"
2,"\\hostname.domain.tld\Memory\Memory Overcommit (1 Minute Avg)"
3,"\\hostname.domain.tld\Memory\Memory Overcommit (5 Minute Avg)"
4,"\\hostname.domain.tld\Memory\Memory Overcommit (15 Minute Avg)"
5,"\\hostname.domain.tld\Physical Cpu Load\Cpu Load (1 Minute Avg)"
6,"\\hostname.domain.tld\Physical Cpu Load\Cpu Load (5 Minute Avg)"
7,"\\hostname.domain.tld\Physical Cpu Load\Cpu Load (15 Minute Avg)"
8,"\\hostname.domain.tld\Physical Cpu(0)\% Processor Time"
9,"\\hostname.domain.tld\Physical Cpu(1)\% Processor Time"
10,"\\hostname.domain.tld\Physical Cpu(2)\% Processor Time"
Ok, I think we have everything covered and can mark this topic as solved I hope you can replace that script with a better solution soon!
Cheers,
Valentin
P.S.
As far as donations go, preferably something that is matched, e.g. if you employer has a policy that matches up to a certain yearly amount and tool to make that easy (e.g. Bright Funds) use that. Any cause will do, animal welfare, climate, "anything to make the world a better place" really.
If you want optimize for impact, check whether the orgs under https://www.givewell.org/charities/top-charities have UK arms.
Or if that is too much work, I'm pretty sure MÉDECINS SANS FRONTIÈRES is in pretty much registered in any country