Cleaning up files with awk
Published at 31 March 2021
#terminal-shell
Needed to clean up a JSON file, after I copied the JSON from the browser and got the line numbers too.
Move every even line to clean file
SHELL$ awk 'NR % 2 == 0' dirty.json > clean.json
Move every odd line to clean file
SHELL$ awk 'NR % 2 != 0' dirty.json > clean.json