Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This will limit the output of 'system_profiler' to the information AFTER 'Battery Information' and BEFORE 'System Power Settings'
/usr/sbin/system_profiler |\
sed '1,/Battery Information/d ; /System Power Settings/,$d'

This comment has been minimized.

Copy link
Owner Author

@tjluoma tjluoma commented Aug 20, 2012

For those of you who may not be familiar with sed, this says "Delete from the first line (1,) up to (and including) the line which includes 'Battery Information', and then delete from the line which includes 'System Power settings' to the end of the file or input ('$d' stands in for 'End Of Input')."

Yes, I'm sure you could probably do this in perl or python or ruby too, but sed works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.