how to replace certain patterns in a file thru unix!!
Hi Friends,
well what i want to do is that suppose i have a file say like
....
ronaldduckdancecoolman
donaldmuckdancepooltactics
fonaldguckdancetoolbutcomps
....
okok i agree this is a ridiculous data for a file.
:-)
now i want that the characters in each line fromposition 16 to say 19 gets replaced by a particular string , in this case the charcters are cool pool and tool , so say i want is the follwoing output:
....
ronaldduckdanceYYYYman
donaldmuckdanceYYYYtactics
fonaldguckdanceYYYYbutcomps
....
or maybe it is possible that the case is that i want to replcae cool,tool and pool by word whose length is greate than the ones which are present say like
....
ronaldduckdanceYYYYYYYYman
donaldmuckdanceYYYYYYYYtactics
fonaldguckdanceYYYYYYYYbutcomps
....
and also suppose i want say that a particular word occurence in every line is replaced by some other word say like i have input file containing
....
ronaldduckdanceYYYYman
donaldmuckdanceYYYYtactics
fonaldguckdanceYYYYbutcomps
....
and i want the file to be manipulated as
....
ronaldduckdanceXXXXman
donaldmuckdanceXXXXtactics
fonaldguckdanceXXXXbutcomps
....
or say different lengths replacement like
....
ronaldduckdanceXXXXXXXXman
donaldmuckdanceXXXXXXXXtactics
fonaldguckdanceXXXXXXXXbutcomps
....
the bottomline being that there r 2 cases one being replacement being on base of position and the other being replaxcement on basis of certain pattern.
HOW do i do this????
PLzzz help
Regards
Manish
__________________
Manish Joneja
|