Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Generate README table from csv #14

Closed
wants to merge 13 commits into from
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ I'm considering crowning certain SBCs with awards every year, like "Fastest stor
## Author

This repository is maintained by [Jeff Geerling](https://www.jeffgeerling.com).

## Test Table (Please Ignore)


TestId | Name | TestDate | CpuTest1Single | CpuTest1Multi | CpuTest2 | GpuTest1 | GpuTest2 | MemTest1 | MemTest2 | NetUp1 | NetUp2 | NetDown1 | NetDown2 | NetBi1 | NetBi2 |
|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|
#4 | Raspberry Pi 4B (8G) | 2023-01-25 | 271 | 760 | TODO | TODO | TODO | TODO | TODO | TODO | TODO | TODO | TODO | TODO | TODO |
3 changes: 3 additions & 0 deletions data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TestId,Name,TestDate,CpuTest1Single,CpuTest1Multi,CpuTest2,GpuTest1,GpuTest2,MemTest1,MemTest2,NetUp1,NetUp2,NetDown1,NetDown2,NetBi1,NetBi2
#IssueID,Product Name, yyyy-mm-dd (UTC),Geekbench,Geekbench,Top500,TBD,TBD,TBD,TBD,iperf3,TBD,iperf3,TBD,iperf3,TBD
4,Raspberry Pi 4B (8G),2023-01-25,271,760,TODO,TODO,TODO,TODO,TODO,TODO,TODO,TODO,TODO,TODO,TODO
52 changes: 52 additions & 0 deletions readmeGen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# Field ID's count from 1
#ID_COL=1
#NAME_COL=2
#DATE_COL=3

genTable()
{
x=0
IFS=','
sed '/^#/d' data.csv | while read -t 0.1 -r -a line
do
# Print table entries
if [ $x -ne 0 ]; then
printf '#%s | ' "${line[0]}" #Print ID
else
printf '%s | ' "${line[0]}" #Print ID
fi
printf '%s | ' "${line[1]}" #Print Product Name
printf '%s | ' "${line[2]}" #Test Date
printf '%s | ' "${line[3]}" #CPU Test 1 Single
printf '%s | ' "${line[4]}" #Cpu Test 1 Multi
printf '%s | ' "${line[5]}" #Cpu Test 2
printf '%s | ' "${line[6]}" #Gpu Test 1
printf '%s | ' "${line[7]}" #Gpu Test 2
printf '%s | ' "${line[8]}" #Memory Test 1
printf '%s | ' "${line[9]}" #Memory Test 2
printf '%s | ' "${line[10]}" #Network Upload Test 1
printf '%s | ' "${line[11]}" #Network Upload Test 2
printf '%s | ' "${line[12]}" #Network Down Test 1
printf '%s | ' "${line[13]}" #Network Down Test 2
printf '%s | ' "${line[14]}" #Network Bidiretional Test 1
printf '%s | ' "${line[15]}" #Network Bidiretional Test 2
printf '\n'

if [ $x -ne 1 ]
then
y=0
printf '%s' '|'
while [ $y -le 15 ]
do
printf '%s' '----|'
y=$((y+1))
done
printf '\n'
fi
x=1
done
}

genTable