Am Sonntag, 11. November 2007 03:27:54 schrieb Chris Arnold:
$ sed -i 's/red/blue/g' file
to replace every entry called red with one that's called blue and write it in the file(-i). You can of course use such things as ./* for the hole directory....
man sed or man awk will provide you with further informations :)
I have a long replacement text like this: <?php require('../../wp-blog-header.php'); ?><?php get_header(); ?><?php include(TEMPLATEPATH."/sidebar1.php");?><div id="main"><div id="content">
and the text that needs to be replaced is: <HTML><HEAD><TITLE>Net Bible - Genesis </TITLE><LINK REL=Stylesheet HREF="style.css" TYPE="text/css" MEDIA=screen></HEAD><body><p class=title>
So the command i run looks like this; sed -i 's/<HTML><HEAD><TITLE>Net Bible - Genesis </TITLE><LINK REL=Stylesheet HREF="style.css" TYPE="text/css" MEDIA=screen></HEAD><body><p class=title>/<?php require('../../wp-blog-header.php'); ?><?php get_header(); ?><?php include(TEMPLATEPATH."/sidebar1.php");?><div id="main"><div id="content">/g' ./*
and i get this error: sed: -e expression #1, char 99: unknown option to `s'
I guess you've to escape various symbols first ;) Greetings Michael