Thursday, May 24, 2007

Usefull Shell commands

Replacing a parameter

x=/home/beyondm/account
src="/"
dis="\/"
result=`echo $x | sed s\}$src\}$dis\}\g`

echo $result will result
/home/beyondm/account

1 comment:

Thilina Anjitha said...

Appending a text (say "Once upon a tim") to each line of the file (eg: y.txt)


sed -i 's/\(.*\)/Once upon a tim \1/g' y.txt