Seems like a lot of trouble only for this. Any other solution?It just seems like a lot of work because you wrote it in English instead of (perl) code. Also, writing the output somewhere else and then replacing the original is safer (and much less work) than modifying the original file in place.
If you have enough memory you can probably do it in one or two lines of code. But I suspect this is homework, so I'm not going to elaborate. See the -i & -p & -0 flags
updated: forgot to add the -0 flag.
In reply to Re: In place file modification
by Joost
in thread In place file modification
by RaduH
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |