Data Munging
Double-space a file
sed -G
Add a newline after every two lines
sed '0~2 s/$/\n/'
Replace newlines with arbitrary text
awk '{ print }' RS='\n' ORS='arbitrary_text'
Work with human-readable e.g. disk ^2 sizes
numfmt --from=iec and numfmt --to=iec
Search Oracle lobs for strings
select whatever from atable where (dbms_lob.instr(lob_column,utl_raw.cast_to_raw('text_to_look_for')) > 0)
Quick n dirty CSV awk
BEGIN {
FPAT = "([^,]+)|(\"[^\"]+\")"
}
(doesn't handle newlines in quotes or escaped quotes though)
Paginated REST results
Paginated json coming back from a rest api? Use a python generator to return it.
Convert Unix time to a different TZ in python
``` import time from datetime import datetime from pytz import timezone, utc now = time.time() t = datetime.utcfromtimestamp(now) lt = utc.localize(t).astimezone(london) print(lt.strftime('%Y-%m-%d %H:%M:%S %Z'))