Re: How to search and replace

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

 



On Thursday 02 February 2006 10:20, Dan Track wrote:
> Hi
>
> I thought I'd ask this here as you guys helped me setup mrtg :)
>
> I've got the following pattern in a text file in linux.
> Target[description1].1.3.4.6.5.3.:string@xxxxxxxxxx
> Directory[description1]: server1
>
> Target[description2].1.3.4.6.4.9.:string@xxxxxxxxxx
> Directory[description2]: server2
>
> What I would like to do is replace the ip of each with the following
> value of "Directory". So for example I would like
> Target[description1].1.3.4.6.5.3.:string@xxxxxxxxxx to become
> Target[description1].1.3.4.6.5.3.:string@xxxxxxxxxxxxxxxxxxx
>
> How can I accomplish this using either C,perl,sed or awk

sed s/string to change/replacement string/ < somefile > someotherfile

Attachment: pgpMliewLUh89.pgp
Description: PGP signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux