Tips tagged grep


10

Tip #743   Grep for word in directory

I've often seen people using the find command on a directory to get all the files, then using these with grep to find files containing a particular word. This can however, be done better just using grep:

Read more »

10

Tip #313   Get latest stable version of the Linux kernel

A simple shell script to get the latest stable version of the linux kernel:

Read more »

10

Tip #290   Crawl a web page for links

lynx -dump http://www.spantz.org | grep -A999 "^References$" | tail -n +3 | awk '{print $2 }' Read more »

9

Tip #215   Calendar with today colored [handle single digit dates]

If your version of grep supports coloring matches, you can use the following to give a calendar with the current date colored:

Read more »

9

Tip #88   a better cut

use `grep -o` to select only the pattern matched rather than the whole line:

Read more »

8

Tip #304   Get your IP in one line

#!/bin/bash
# by dj.r4iden
echo "Your ip Address is" `lynx --source http://www.formyip.com/ |grep The | awk {'print $5'}` Read more »

8

Tip #384   BBC Weather

Go to [http://www.bbc.co.uk/cgi-perl/weather/search/new_search.pl] and search for your location. Copy the link to the 3 day forecast feed, for example [http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/0105.xml]. Then just put that link into the following command to get a quick command line weather forecast.

Read more »

8

Tip #282   Highlight Grepped Text

Grep file(s) and highlight the grep matches using less...

Read more »

6

Tip #258   List non-system users

I use the following to list non-system users. It should be portable though won't work on systems without the getent command.

Read more »

6

Tip #64   Find occurrences of a string in a large code base without firing

example, look for all the TODO and HACK strings I left in large java project and show a bit of context before and after using the -C switch of grep.

Read more »