| Subcribe via RSS

Stupid sed tricks

October 17th, 2005 | No Comments | Posted in Bash, Simple Tips

I just learned that you can use any character, not just the slash (/), for a delimitter when substituting with sed. Most unique characters should work.

This is especially useful when editing streams of file paths.

Here’s an example that modifies the path in a playlist:

cat list.m3u | sed ’s+/home/aolsen/+~/+’

The +’s worked well as a delimitter here and eliminate the need to quote the /’s

This also works in vi.
–Anton

Manual Firefox 1.5b1 install on Fedora Core 4

October 1st, 2005 | No Comments | Posted in Browser, Simple Tips

This should work on other similar systems.

su or login as root first.

# wget http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.5b1/linux-i686/en-US/firefox-1.5b1.tar.gz

# cd /usr/lib
# tar xzvf ~/firefox-1.5b1.tar.gz
# mv firefox firefox-1.5b1
# which firefox
/usr/bin/firefox
# cd /usr/bin/
# mv firefox old.firefox
# ln -s /usr/lib/firefox-1.5b1/firefox .

That should do it, and shouldn’t affect any of your launchers or file associations.

[update]  It appears that you may need the compat libs for this to work.  If you use a package manager, search for ‘compat’ and you should find something like compat-libstdc++ or libstdc++-compat.  If you install them FF should be happy.

great sed howto

March 29th, 2005 | No Comments | Posted in Simple Tips

I found this with google earler. It’s a great document for anyone getting started with shell scripting, and I’m certain even seasoned veterans can learn a few tips.

Sed - An Introduction

read a file with bash

March 23rd, 2005 | 60 Comments | Posted in Bash, Simple Tips

I’m going to try to post a few howto articles for some of the simpler tasks. Many of these will be things that I use daily.

It is often necessary to read a file with bash, and act upon the entire line. There are many different ways to do this, but I’ll outline two of the simpler methods, both suitable for stacking on a single command line.

For this exercise I’ll assume the file is a list of files that we need to execute a command on.

# cat file.lst |while read line; do echo "${line}"; done /tmp/file1.txt /tmp/file with space.txt #

More »