commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
cut can handle files as well. No neet for a cat.
The first sort is necessary for ips in a list to be actually unique.
Show's per IP of how many requests they did to the Apache webserver
Commandline perl filter for, using a production.log from a rails app, display on realtime the count of requests grouped by "seconds to complete" (gross round, but fair enough for an oneliner) :)
Removes all lines between the lines containing "" and "", including these lines itself
Sometimes when working with XML files without an graphical editor, large comment-/annotation-blocks taper the readability to walk through the file. I like to create a copy of such documents without these annotations. As the documentation itself is in documentation tags inside the annotation tags an therefore graphical editors tend to put the annotation tags in their own lines, this command removes all documentations within annotation-tags.
Applying filter rules is what makes this a really useful command. It's usually a pain to figure out how to sync ONLY files matching a particular pattern, and often one reverts to goofy stuff like find .. -exec rsync ..
The filter hides all folders from the transfer, so that only the matching folders that store the filename are left for the sync.
This line does not include your closing tag in the output.
Working with log files that contains variable length messages wrapped between open and close tags it may be useful to filter the messages upon a keyword.
This works fine with GNU sed version 4.2 or higher, so pay attention to some unix distros (solaris, hp-ux, etc.).
Linux should be ok.