App::RecordStream::Manual::Examples - A set of simple recs examples
This file provides a couple of useful examples of recs chains and how each of them break down. This is meant as a learning tool for folks new recs that would like to see some cool things you can do with RecordStream. Another good resource is App::RecordStream::Manual::Story, also viewable by running recs story, which is a humorous story meant to get the newest users used to recs.
recs story
recs fromps | recs collate --key uid -a count | recs sort --key count=n | recs totable
Broken down this is:
First get the records of all the prcesses currently running
Grouping by the uid field, count how many records fall into the group (stored in the count field by default)
uid
count
Sort the resulting records by the count field numerically (rather than lexically)
Print the output in a nicely formatted plain text table
recs fromps | recs collate --key uid,priority -a count | recs toptable --x priority --y uid --v count
Broken down:
Grouping by the uid and the priority field, count how many records fall into the group
Create a 2 dimensional table (a pivot table), across the top put the priority values, down the side put the uid, in each cell put the value of the count field for that priority/uid.
What Xorg modules put information in my Xorg.log at startup, and what log level are they logged at? I need this in CSV format for importing into a spreadsheet program.
recs frommultire --re 'type,module=\((\S*)\) ([^:]+):' /var/log/Xorg.0.log \ | recs collate --key type,module -a ct \ | recs sort --key ct=n \ | recs tocsv --header
Parse out the type and module from the Xorg log file. That regex captures non-whitespace inside a literal () pair, then captures text after a space up to the first : (colon).
()
:
Collate records into groups of type-modules, and count how many in each group across all records
Sort by the count, numerically
Output a table in spreadsheet format (no ASCII art), delimited by commas
See App::RecordStream for an overview of the scripts and the system
Run recs story or see App::RecordStream::Manual::Story for a humorous introduction to RecordStream
To install App::RecordStream, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::RecordStream
CPAN shell
perl -MCPAN -e shell install App::RecordStream
For more information on module installation, please visit the detailed CPAN module installation guide.