Sorry I made a mistake in giving my input file . now I corrected in my previouse post .
Thanks for your kind reply and time.. But actually the above will replace all the occurances of TAS2 to TAS. which will drastically change my files which i dont want..
So it should change only when matches my patteren
My patteren is like following
1.starting with zero/one/ more spaces or tabs
2.then TAS2
3.zero/one/ more spaces or tabs
4. then opening parenthesis "("
5.zero/one/ more spaces or tabs
6. 8 followed by " ' "
7.any character "o","b","h" or "d"
8.then followed by any no charater [a-f| A-F| 0-9]
9.zero/one/ more spaces or tabs
10.then closing ")" parenthesis
11.zero/one/ more spaces or tabs
12. finishing with a ";"
an example :- TAS2 ( 8'h00) ;
Where it will find that above expression it should replace TAS2 to TAS but no other changes in that lin.
Earlier I tried with the follwing command but I failed
grep "[1]TAS2[ \t]([ \t]*8'[b|o|d|h][0-9|a-f|A-F][ \t])[ \t];" ad0_signstbin_002.file | sed 's/TAS2/TAS/g'
One more thing I cant able make a ditto copy of my file becoz all tabs and spaces it squezes automatically after posting .
Hope this time my explanation is clear and watting for your reply
your last posting was obviously more detailed than before but I - for one - am still not sure what you want.
May I suggest your repost your original file and use a specific character to represent spaces - say '_' or ''. That way the posting will not 'corrupt' your messages and we can get a better idea of what you want.
Give the input file *and what you want as an output.
best regards
If the output is what you want, simply replace all the occurrences of "[-t]" in the sed command with a space and a tab! Hope it works
Oh, I've removed all the comments at the end of the lines but it should work also with comments.
But Is there any way to change the file permanently without any inbetween files.
If I m not wrong I think in the above sed command I ve to redirect to file then move to the original file name like
sed "/[1]TAS2[ ^I]([ ^I]*8'/s/TAS2/TAS/" file1 > file2
mv file2 file1
Like in perl if we give the command like below it changes the input file
Input
Noptx(5) // remain the same
-*Nop(3);
Nop(9);
--Nop(8); // remain the same d3
**---Nop(7); //remain the same d3
**---Nop(7);
*--Nop(6);
--**Nop(5);
-Nop(4);
Nop(3);
represents a space
represents a tab space
Desired OUPUT
Noptx(5) // remain the same
-*Nop(6);
Nop(18);
--Nop(8); // remain the same d3
**---Nop(7); //remain the same d3
**---Nop(14);
*--Nop(12);
--**Nop(10);
-Nop(8);
Nop(6);
I want to change the no to two times but which matches the below patteren
CASE-1: Zero or more spaces/tabs then Nop AND
CASE-2: The line should not end with d3 .
Basically if both patteren matches then double the no inbetween ()
Previously I ve a suggestion but that wont work for the first statement in my input file