[SATLUG] Command Line Warriors - Ten Cool Coreutils Commands

michael michael at michaelrice.org
Mon Feb 9 14:21:09 CST 2009


I have seen many people on the net mentioning about counting grep 
results by piping though to wc -l just an fyi grep will count its own 
results -c or --count

Mike Wallace wrote:
> On Fri, Feb 6, 2009 at 11:05 PM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
>
>   
>> ed wrote:
>>
>>     
>>> Hey folks?  Is this old news,
>>>
>>>       
>> Yes.
>>
>>  or useful?
>>     
>> Some are, some aren't.  The most common place you see these is in scripts.
>>
>> I use tee and wc relatively often.  I occasionally use 'yes' and the
>> programming version of stat.  It's easier to use vim instead of expand
>> unless you need to do it to a lot of files.  I use a2ps instead of pr.
>>
>> The rest are not very useful.
>>
>>     
>
>
> Of all the commands, I use wc the most, but 95% of the time, it's with the
> -l option.  Rarely do I count lines in a file, but instead I count total
> results returned from other commands (find, grep, etc).
>
> I don't use it much, but when necessary the uniq command can be very
> useful.  I usually only use "uniq -c" which gives a count of occurances.  I
> like counting things.  Can you tell?  Say you need to know how many .mp3
> files each user has under their home directory.  Just pipe together a find,
> cut, sort and uniq.
>
> I use "tail -f" rather than tee.  With tail, you can watch the activity on
> any file being appended to, regardless of the process that created it.
> Also, if you need to temporarily do something else, you can ^C the tail
> process, do something, and then "tail -f" again.  There's no doing any of
> that with tee.
>
> The split command is useful when you need to look at some monster sized log
> file and the file is so large that vi/emacs won't open it.  Otherwise, it is
> pretty useless.
>
> -Mike
>   


More information about the SATLUG mailing list