Another two useful one liner.
First
awk. Sometimes you need to grab last "element" of lines in a file which has different numbers of spaces (or other separator). In such case use variable
$NF (or
$NF-1,
$NF-2...). Good example for such situation might be apache log file, where user agent description is a string with various number of spaces, so it's hard to get columns after that. But you can use something similar to:
tail bo-access_log.2009-06-22 | \
awk '{print "size:\t"$(NF-1) "\t time:\t" $NF}'
In the example log file the time is the last and size of file next to last field. Of course you can type it in one line. But Then you have to remove '\' character from end of first line.
Second advice is related to
SVN. I found reverting last submitted changes quite not clear there. Revert works only with no committed changes, so I used the command similar to below one.
svn merge -r HEAD:{2009-06-21} .
The example reverts everything what has been submitted between 21st June 2009 and 'now'. However, today I found that
PREV 'variable', so the following command should do I had wanted to achieve. Interesting how could I missed it?
svn merge -r HEAD:PREV .
And one more update. In
petke comments to this
entry in Aral Balkan blog I found another one liner, which looks event easier:
svn update -r 2689
No comments:
Post a Comment