Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Wednesday, February 6, 2013

Get a column from output and then get unique values

log example :

[02/06 06:20:01:664] [Thread-0] [ExtractJob][INFO]: ExtractJob execute started.
[02/06 06:20:01:666] [Thread-0] [Extracter][INFO]: send request for: Universe=RVUS0; ...
[02/06 06:20:04:135] [Thread-0] [Extracter][INFO]: request failed for 20130206 ....
[02/06 06:20:04:135] [Thread-0] [Extracter][INFO]: send request for: Universe=RVUS0; we....
[02/06 06:20:23:593] [Thread-0] [Extracter][INFO]: Extracting file: 36827dba-e66f-444a-b730-7.csv



print events times rounded to minutes:

[user@server ~]$ grep "ERROR" /www/logs/my.app.log | cut -d ':' -f 1,2,3 | sort | uniq

[02/06 06:20:01
[02/06 06:20:04
[02/06 06:20:23
[02/06 06:20:24

Wednesday, October 10, 2012

Mongo: get all results to file instead of page iteration


http://www.mongodb.org/display/DOCS/Scripting+the+shell
paragraph "Differences between scripted and interactive / Printing".

connect to host:
./mongo server.com/mydb
> db.users.find()


to do the same from shell:

./mongo server.com/mydb --quiet --eval "db.users.find().forEach(printjson);" > 1.txt

Attention: for prefix ".forEach(printjson);" without it you will get error like
DBQuery: mydb.users-> undefined 

Tuesday, September 18, 2012

How to color grep result output

On one meet up I noticed that some representative have colored grep result that is convenient:

So it is not a rocket science - link.

Briefly do:
export GREP_OPTIONS='--color=auto'