Skip to content

Instantly share code, notes, and snippets.

@sloanlance
Last active December 16, 2016 18:02
Show Gist options
  • Save sloanlance/ace9bc62ab9322e9916bfa3311b4b876 to your computer and use it in GitHub Desktop.
Save sloanlance/ace9bc62ab9322e9916bfa3311b4b876 to your computer and use it in GitHub Desktop.
#!/bin/sh --
# The macOS "defaults domains" command writes a comma-delimited list of domains to stdout.
# I wanted to get the domains as a list, one per line, without commas.
# Inspired by:
# http://stackoverflow.com/questions/723157/how-to-insert-a-newline-in-front-of-a-pattern
# http://stackoverflow.com/questions/17363030/how-do-i-insert-a-newline-linebreak-after-a-line-using-sed
# Default output
defaults domains
# com.apple.quicktimeplayer, com.apple.recentitems, com.apple.registration, com.apple.reminders, com.apple.scheduler, com.apple.screencapture
# Output with linebreaks
defaults domains | sed $'s/, /\\\n/g'
# com.apple.quicktimeplayer
# com.apple.recentitems
# com.apple.registration
# com.apple.reminders
# com.apple.scheduler
# com.apple.screencapture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment