defaults domains | tr ',' '\n' | more
This still leaves some lines beginning with spaces, but I haven't yet figured out how to remove those, too.
|
|
|
The defaults system in Mac OS X allows you to manipulate application and system preferences (.plists) from the CLI. In order to display the list of available domains, you can type defaults domains, but the output is all on one line with domains separated by commas (see this previous hint). The following command will translate those commas into newlines, and then paginate the output with more:
This still leaves some lines beginning with spaces, but I haven't yet figured out how to remove those, too.
•
[3,245 views]
Hint Options
Cleaner display for 'defaults domains' command
> This still leaves some lines beginning with spaces, but I
haven't yet figured out how to remove those, too.
Try this:
It uses
Cleaner display for 'defaults domains' command
Another way:
defaults domains | tr -d ' ' | tr ',' '\n' | more
Cleaner display for 'defaults domains' command
My code changed between its preview and its posting. The end of
Cleaner display for 'defaults domains' command
this removes leading and trailing whitespace (if any
exists):
(should be all one line of code - don't know why its being
autowrapped here these days)
Cleaner display for 'defaults domains' command
Of the three posted so far, this is the only one that seems to
Cleaner display for 'defaults domains' command
Quick tip:
Cleaner display for 'defaults domains' command
Oh, one important thing I forgot was to say that I also ran 'chmod 777 ~/Scripts/domainlist' to make it executable.
Cleaner display for 'defaults domains' command
or in perl:
this will remove spaces at the beginning.
Cleaner display for 'defaults domains' command
not that perl is probably the way to go here, but to clean up the
specials and shorten a bit:
Cleaner display for 'defaults domains' command
hmm, how to get the backslashes? The showed up in the
preview...:
code, single slash:
code, double slash: pre, single slash: defaults domains | perl -pe 's/,\s*/\n/ g' pre, double slash: defaults domains | perl -pe 's/,\s*/ \n/g'
Oh Lordy
Props to anyone crazy enough to write a huge-ass sed
expression, but how about:
defaults domains | tr -s ', ' '\n' | more
Cleaner display for 'defaults domains' command
defaults domains | tr ',\ ' '\n' | more |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.30 seconds |
|