[NTLUG:Discuss] Linux script question
Pervaz Allaudin
pervaz at att.net
Mon Jun 16 14:37:25 CDT 2003
Thanks that's what I wanted.
Any good tutorial sites of the top of your heads
Pervaz
Bug Hunter wrote:
>On Mon, 16 Jun 2003, Chris Cox wrote:
>
>
>
>>Pervaz Allaudin wrote:
>>
>>
>>>OK I have another linux command question.
>>>
>>>I have multiple files in multiple dirs. under a dir. from which I want
>>>to replace a word and then written back; Either in the same files or
>>>another dir. as root.
>>>
>>>I got till
>>>
>>>find src -iname *.ext | xargs sed /oldtext/newtext/
>>>
>>>
>>>
>
> for a single file:
>
> sed /oldtext/newtext/ filename > filename.newfile
> rm -f filename
> mv filename.newfile filename
>
>
>in bash
>
> for i in /dirname/*
>do
> sed /oldtext/newtext/ $i > $i.newfile
> rm -f $i.newfile
> mv $i.newfile $i
>done
>
> This was given to me by a fellow named Richard a while back. :)
>
>bug
>
>
>
>_______________________________________________
>https://ntlug.org/mailman/listinfo/discuss
>
>
>
More information about the Discuss
mailing list