6.6. CSV Non-Standard

6.6.1. SSHd Config

  • /etc/ssh/sshd_config

  • delimiter=' '

ChrootDirectory none
ClientAliveCountMax 3
ClientAliveInterval 0
Compression delayed
MaxStartups 10:30:100
PidFile /var/run/sshd.pid
X11Forwarding no
X11UseLocalhost yes
>>> delimiter = ' '
>>> result = [row.split(delimiter) for row in DATA.splitlines()]  

6.6.2. Config

  • /etc/postgresql/12/main/postgresql.conf

  • delimiter=' = '

listen_addresses = 'localhost'
port = 5432
max_connections = 100
ssl = on
password_encryption = on
db_user_namespace = off
>>> delimiter = ' = '
>>> result = [row.split(delimiter) for row in DATA.splitlines()]  

6.6.3. Properties

  • Java properties

  • delimiter='='

sonar.projectKey=MP
sonar.projectName=MyProject
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.verbose=true
>>> delimiter = '='
>>> result = [row.split(delimiter) for row in DATA.splitlines()]  

6.6.4. Passwd

  • /etc/passwd

  • delimiter=':'

root:x:0:0:root:/root:/bin/bash
watney:x:1000:1000:Mark Watney:/home/watney:/bin/bash
lewis:x:1001:1001:José Jiménez:/home/lewis:/bin/bash
twardowski:x:1002:1002:Jan Twardowski:/home/twardowski:/bin/bash
>>> delimiter = ':'
>>> result = [row.split(delimiter) for row in DATA.splitlines()]  

6.6.5. Hosts

  • delimiter='\s+'

##
# `/etc/hosts` structure:
#   - IPv4 or IPv6
#   - Hostnames
##

127.0.0.1       localhost
127.0.0.1       astromatt
10.13.37.1      nasa.gov esa.int roscosmos.ru
255.255.255.255 broadcasthost
::1             localhost

6.6.6. Crontab

  • /etc/crontab

  • delimiter=' '

# [Minute] [Hour] [Day_of_the_Month] [Month_of_the_Year] [Day_of_the_Week] [command]
*/5 * * * *          /usr/bin/python3 /home/python/run-5min.py 1>/dev/null
* * * * *            /usr/bin/python3 /home/python/run-1min.py 1>/dev/null
00 * * * *           /home/python/run.py 1>/dev/null
* * * jan,may,aug *  /home/python/run.py
0 17 * * sun,fri     /home/python/run.py
0 */4 * * *          /home/python/run.py
0 4,17 * * sun,mon   /home/python/run.py

6.6.7. Key-Value

  • /etc/locate.rc

  • .env from Docker

  • delimiter='='

TMPDIR="/tmp"
FCODES="/var/db/locate.database"
SEARCHPATHS="/"
PRUNEPATHS="/tmp /var/tmp"
DATABASE_ENGINE=postgresql
DATABASE_SERVER=localhost
DATABASE_PORT=5432
DATABASE_NAME=mydatabase
DATABASE_USERNAME=myusername
DATABASE_PASSWORD=mypassword
# temp directory
TMPDIR="/tmp"

# the actual database
#FCODES="/var/db/locate.database"

# directories to be put in the database
SEARCHPATHS="/"

# directories unwanted in output
#PRUNEPATHS="/tmp /var/tmp"

6.6.8. Sensors

  • delimiter=';'

Name;Long;Lat;ModuleName;ModuleType
"European Astronaut Centre (EAC) - ESA";50.8524881,7.1315254;;Indoor
Timestamp;"Timezone : Europe/Berlin";Temperature;Humidity;CO2;Noise;Pressure
1622498702;"2021/06/01 00:05:02";22.6;46;981;32;1019.1
1622499004;"2021/06/01 00:10:04";22.6;46;981;31;1019.1
1622499306;"2021/06/01 00:15:06";22.6;46;968;32;1019.1
1622499608;"2021/06/01 00:20:08";22.5;46;940;31;1019.1
1622499912;"2021/06/01 00:25:12";22.5;46;907;32;1019
1622500214;"2021/06/01 00:30:14";22.5;46;877;31;1019
1622500517;"2021/06/01 00:35:17";22.4;46;873;32;1019
>>> DATA= """Name;Long;Lat;ModuleName;ModuleType
... "European Astronaut Centre (EAC) - ESA";50.8524881,7.1315254;;Indoor
... Timestamp;"Timezone : Europe/Berlin";Temperature;Humidity;CO2;Noise;Pressure
... 1622498702;"2021/06/01 00:05:02";22.6;46;981;32;1019.1
... 1622499004;"2021/06/01 00:10:04";22.6;46;981;31;1019.1
... 1622499306;"2021/06/01 00:15:06";22.6;46;968;32;1019.1
... 1622499608;"2021/06/01 00:20:08";22.5;46;940;31;1019.1
... 1622499912;"2021/06/01 00:25:12";22.5;46;907;32;1019
... 1622500214;"2021/06/01 00:30:14";22.5;46;877;31;1019
... 1622500517;"2021/06/01 00:35:17";22.4;46;873;32;1019"""
>>>
>>>
>>> metadata_header, metadata_values, data_header, *data_values = DATA.splitlines()
>>>
>>> metadata_header = metadata_header.split(';')
>>> metadata_values = metadata_values.split(';')
>>> data_header = data_header.split(';')
>>> data_values = [line.split(';') for line in data_values]
>>>
>>>
>>> metadata_header
['Name', 'Long', 'Lat', 'ModuleName', 'ModuleType']
>>>
>>> metadata_values
['"European Astronaut Centre (EAC) - ESA"', '50.8524881,7.1315254', '', 'Indoor']
>>>
>>> data_header
['Timestamp', '"Timezone : Europe/Berlin"', 'Temperature', 'Humidity', 'CO2', 'Noise', 'Pressure']
>>>
>>> data_values  
[['1622498702', '"2021/06/01 00:05:02"', '22.6', '46', '981', '32', '1019.1'],
 ['1622499004', '"2021/06/01 00:10:04"', '22.6', '46', '981', '31', '1019.1'],
 ['1622499306', '"2021/06/01 00:15:06"', '22.6', '46', '968', '32', '1019.1'],
 ['1622499608', '"2021/06/01 00:20:08"', '22.5', '46', '940', '31', '1019.1'],
 ['1622499912', '"2021/06/01 00:25:12"', '22.5', '46', '907', '32', '1019'],
 ['1622500214', '"2021/06/01 00:30:14"', '22.5', '46', '877', '31', '1019'],
 ['1622500517', '"2021/06/01 00:35:17"', '22.4', '46', '873', '32', '1019']]