From this answer I have reduced a log file to this:
Timestamp:1359021601 2013-01-17 15:00:01
size: 10G /mnt/SolrFiles/solr/api/
Timestamp:1359025201 2013-01-17 16:00:01
size: 11G /mnt/SolrFiles/solr/api/
...snip hundreds of lines...
Timestamp:1359021601 2013-01-24 10:00:01
size: 11G /mnt/SolrFiles/solr/api/
Timestamp:1359025201 2013-01-24 11:00:01
size: 11G /mnt/SolrFiles/solr/api/
Timestamp:1359028801 2013-01-24 12:00:01
size: 11G /mnt/SolrFiles/solr/api/
Timestamp:1359032401 2013-01-24 13:00:01
size: 12G /mnt/SolrFiles/solr/api/
That pattern will carry on for hundreds of lines. I would like to reduce the file to only show the Timestamps and sizes when the size changes, like this:
Timestamp:1359021601 2013-01-17 15:00:01
size: 10G /mnt/SolrFiles/solr/api/
Timestamp:1359025201 2013-01-17 16:00:01
size: 11G /mnt/SolrFiles/solr/api/
Timestamp:1359032401 2013-01-24 13:00:01
size: 12G /mnt/SolrFiles/solr/api/
Can this be accomplished using common Linux CLI tools such as grep and sed?
$HOME/bin
. Even better would be a one-liner that I could bang out from memory and impress my colleagues with! I'll be using this from a few terminals SSHed into a few different servers. – dotancohen Jan 24 '13 at 15:01