in reply to Changing string in specific line/position in a file
Google searches seem to only mention either using 'sed' (which I can readily do in a shell script, but am trying to do this in a more efficient and readable way using Perl)
Agreed. Write the whole thing in Perl. That will be much more maintainable and enjoyable than hacking out a motley mix of shell/sed/awk/grep. The key reason is that Perl can comfortably scale to much larger scripts. In my experience, "small" shell scripts have a way of growing ... and growing ... and growing ... until they become maintenance nightmares! But, by then, how do you justify a rewrite? The cost of rewriting, the opportunity cost of not working on something else, and the risk of breaking previously working code in the rewrite. So write the whole thing in Perl to start with.
For more detail on this topic, see Unix shell versus Perl.
|
|---|