ShTips

Delete Line Feed Code by DOS and Bash

Input JSON text.txt : { "values": [ [ "a1", "b1", "c1" ], [ "a2", "b2", "c2" ], [ "a3", "b3", "c3" ], [ "a4", "b4", "c4" ], [ "a5", "b5", "c5" ] ] } Windows DOS type text.txt | jq -c "." Linux Bash $ cat text.txt | jq -c '.' Output JSON {"values":[["a1","b1","c1"],["a2","b2","c2"],["a3","b3","c3"],["a4","b4","c4"],["a5","b5","c5"]]}

Add next row to current row using AWK

File.txt : a1 a2 a3 a4 a5 a6 Code : awk '{array[NR]=$0} END {for (i in array) {if (i>1) {{print array[i-1]","array[i]}}}}' File.txt Result : a1,a2 a2,a3 a3,a4 a4,a5 a5,a6 After the all rows are imported to an array, it shows next row to current row under a condition of row > 1.

One Liner Code for Netatmo

I made One Liner Code to retrieve data using Netatmo API. There are 2 ways. One is for windows dos. Another is for unix bash. Requirement tools are curl and jq. windows dos > setlocal & curl -s -d "grant_type=password&client_id='#####'&client_secret='#####'&username='#####'&password='#####'&scope=read_station" "https://api.netatmo.net/oauth2/token" | for /f "usebackq tokens=*" %a in (`jq -r ".access_token"`) do @set a="%a" | curl -s -d "access_token=%a&device_id='#####'" "https://api.netatmo.net/api/getstationsdata" > dat.txt & for /f "usebackq tokens=*" %b in (`jq -r ".