smart grouping shorten long command line 2
* * * * * 1 votos
June 19th, 2007 mysurface Posted in Symbol, curly brackets, tar | Hits: 21544 |
This post is to illustrate additional usage of curly brackets { } for range of numbers, continues from smart grouping shorten long command line.
Let say you have a list of logs where you want to pick a range of logs for analysis, the sample log files shows as bellow
tcp_06062007_1.txt
...
tcp_06062007_180.txt
tcp_06062007_181.txt
tcp_06062007_182.txt
...
tcp_06062007_230.txt
In order to archive logs from range 182 until 192, you do this
tar cjvf tcp_log.tar.bz2 tcp_06062007_{182..192}.txt
Remember DON’T use square bracket [ ] , square bracket is for character block, where by doing [189-192] will means 1 or 8 or 9 or 2 instead of the intended range from 182 to 192.
Live Chat!









Leave a Reply