[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: help needed for converting strings in a file



Am 2005-11-10 21:22:53, schrieb Sourabh Bora:
> hi,,

>       The logic is --1)delete http://www.
>                       2) replace '/' '?' etc with '_'
> 
>      I want to write a script using sed or awk which will do all the
> conversion in a file..

What about:

----8<--------------------------------------------------------------
#!/bin/bash

cd $DIR

for X in `find -name "*.html"` ; do
  sed "s,http://www\.micronux\.com/catalog/,./micronux.com_catalog,g"; $X >$X.tmp
  mv $X.tmp $X
done
----8<--------------------------------------------------------------


Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)



Reply to: