Tips tagged sed


Tip #878   Random xkcd comic

Displays a random xkcd comic. Requires ImageMagick.

Read more »


Tip #210   Calendar with current date

Add the following sed commands to cal to get a calendar with the current date marked:

Read more »


Tip #171   Duplicate directory tree

The following command creates in the /usr/project directory, a copy of the current working directory structure:

Read more »


Tip #539   Using sed across multiple lines

Sometimes when using sed you find that you need to match across line endings, this can be achieved by getting sed to match the first line and then pulling a second line into the buffer with the N command.

For example, if we have a file: Read more »


Tip #384   BBC Weather

Go to [] and search for your location. Copy the link to the 3 day forecast feed, for example []. Then just put that link into the following command to get a quick command line weather forecast.

Read more »


Tip #487   Print part of a file

Print the contents of a file from a given regular expression to another

Read more »


Tip #182   MAC address conversion

Convert mac addresses such as 000000abde00 into 00:00:00:ab:de:00

awk '{for(i=10;i>=2;i-=2)$0=substr($0,1,i)":"substr($0,i+1);print}' macaddress_list
sed 's/\(..\)/\1:/g;s/:$//' macaddress_list

// sil at
Read more »


Tip #540   Command examples from shell-fu

The following isn't particularly pretty and should be considered a work in progress, but it's quite fun.

Get examples of ways a command can be used direct from shell-fu by adding the following alias:
Read more »