Tips tagged sed


10

Tip #878   Random xkcd comic

Displays a random xkcd comic. Requires ImageMagick.

Read more »

15

Tip #701   Stream YouTube videos directly to your media player

YouTube is great, but the embedded flash player doesn't offer a lot in the way of customizing your viewing experience. There are quite a few options for downloading flv video files from YouTube, but adding the following function to your bashrc will let you stream them directly to your choice of media player.

Read more »

4

Tip #572   Print until no match

This bit of sed will print the contents of a file until the first line which doesn't contain the specified expression. A useful alternative to 'head' when you're not sure how much of the file you need.

Read more »

4

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 »

9

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 »

7

Tip #487   Print part of a file

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

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 »

11

Tip #300   Find and replace on specific files

Selective content replace on files. For example to replace '<?' with '<?php' in all PHP files:
Read more »

11

Tip #294   Mass-renaming files

Mass-renaming files using find and sed:
Read more »