<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 2012-07-30, at 7:26 PM, Mike Pfaiffer wrote:</div><blockquote type="cite"><div><font class="Apple-style-span" color="#000000"><br></font><span class="Apple-tab-span" style="white-space:pre">        </span>I'm going to think a little outside the box. The lines you want to insert into the existing file... Is there a pattern? Can they be generated ahead of time and stored in temporary files? I gather the lines are consecutive... If all this is the case then all you have to do is determine the start and end of the section you want to replace. I think you could then use head, cat, and tail to recreate the file you want then just mv it.<br><br></div></blockquote><div><br></div>You are thinking along the right lines though I answered a few of those points already.</div><div>The lines I'm replaceing with is already in a file (replacement.txt) and the chunk of stuff I'm replacing will be between lines 23 and 56 of the file. &nbsp;The contents of lines 23 through 56 may have different values on each host but they will be represented.</div><div><br></div><div>Building up with head and tail is not a bad approach but requires the use of a temporary file and if this data set was huge would be a bit cumbersome (if you use /tmp via mktemp which is could be different file system etc.).</div><div><br></div><div>This is not a good problem for cat though... head and tail is serviceable. &nbsp;Thanks for your thoughts on this.</div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--&nbsp;</div><div>Sean</div><br class="Apple-interchange-newline"></span></span></span>
</div>
<br></body></html>