Replacing a string in every file in a directory using sed

Well I came across the need to replace a string in every file in a directory this morning, so I decided to write a script to do it for me.

This script takes a directory as a parameter, loops through every file in that directory and replaces string one with string 2

#!/bin/bash
#by Jeff Miller

usage()
{
echo "Usage: replace "
echo "This program scans for files in a directory and uses sed to replace values"
}

#Check we have the right number of arguments
if [ $# -ne 3 ]
then
usage
else

Kubuntu 7.04 short review

Well after my motherboard died about a month or so back I lost my desktop and had to reinstall. I took this opportunity to try out Vista, which about met expectations for a Microsoft product (frequent software crashes), although I love the new interface and start menu.

I was not in a big rush to throw a Linux desktop back on since I had my server to play with, but last night I decided to take the plunge and install Kubuntu, which is the equivalent of Ubuntu except with KDE software instead of Gnome.

Fun with command line

Well I get to take a CIS 200 level class for my associates, my friend is in the class with me and I was bored listening to the instructor go over the basics. So I decided to have some fun, and I found a quick simple command to really get someone with, luckily he was sitting next to me to help my amusement. This assumes the both of you are logged into the same system.

cat /dev/urandom | write username

You can try cat /dev/urandom to see what the user will see on your own, although it takes many ctrl-c to break it sometimes.

Creating schedules under Linux

Linux uses a program called cron to handle all schedules. It is pretty simple to create a schedule

I wrote a simple could be written better script below that checks for disk space and emails me if it is below a certain value

free="echo `df -h | grep apps | cut -d " " -f 21 | cut -d "G" -f 1`"
NUM=`$free | cut -d "." -f 1`
echo $NUM
if [ $NUM -lt 5 ]; then
echo "You only have $NUM gigs of space on ups1app6" | mail -s "SPACE ALERT UPS1APP6" jeff@myemail.com
fi

this is located in my home directory

Writing a script to delete the contents of a directory

Well I recently ran out of inodes on my dev box at work on my /var partition, this affected my ability to run updatedb or use yum as I found out. How did I know I ran out of inodes?

Fedora 7 Released

Thats right, read the Slashdot Article Here

LOLCODE

Nothin quite gets you going in the morning like some LOL. Someone decided to create a LOL Language for coding, Check it out here

Sample:

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
UP VAR!!1
VISIBLE VAR
IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE

Dell Launches Linux Line today

Looks like it held true, Dell released their Linux line of Ubuntu machines today

Check it out on /.

Last.fm

So I was listening to some of my MP3 collection in banshee and I saw a pop up at the bottom linking to similar artists, curious I clicked and was taken to http://www.last.fm/

Seems like a pretty cool site, check it out.

Dell officially selling Ubuntu systems

From news.com.com

"At the end of May, the No. 2 PC maker will begin selling some consumer-focused laptop and desktop models with Ubuntu's new "Feisty Fawn" version of Linux installed, Dell spokesman Kent Cook said. The company announced the Linux move on Tuesday on its IdeaStorm site, launched in February to gather feedback directly from customers about what they want.

Syndicate content