Skip to content

Instantly share code, notes, and snippets.

@tjluoma
Created August 19, 2012 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjluoma/3398050 to your computer and use it in GitHub Desktop.
Save tjluoma/3398050 to your computer and use it in GitHub Desktop.
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'
@tjluoma
Copy link
Author

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