"firstname": "Barack", "lastname": "Obama", "favoritepet": "cat", "favoritecolor": "purple" "firstname": "Donald", "lastname": "Trump", "favoritepet": "dog", "favoritecolor": "brown" "firstname": "Ronald", "lastname": "Reagan", "favoritepet": "bird", "favoritecolor": "yellow" "firstname": "Thomas", "lastname": "Jefferson", "favoritepet": "snake", "favoritecolor": "pink"We create a file with this contents, and call it dataF.
#!/bin/bash let "start = ($1-1)*4+1" let "end = $start + 3" sed -n "$start,$end p" $2 | \ sed ' /firstname/ { i\ { } /favoritecolor/ { a\ } } 'Assuming both our files (dataF and utlscrpt) are in the same directory and utlscrpt has execution permissions. In a terminal, we move to this directory, and run the command:
./utlscrpt 3 dataF
{ "firstname": "Ronald", "lastname": "Reagan", "favoritepet": "bird", "favoritecolor": "yellow" }Therefore we can insert the third data record into the DB at /YourDBPath by running:
./utlscrpt 3 dataF | firebase database:push /YourDBPath
for i in {1..4}; do ./utlscrpt $i dataF | firebase database:push /YourDBPath; done
Challenge learning a new language with your iPhone
You are looking for some selected technical tutorials, to brush up you knowledge or because you would need some reminders. Have look here.