Skyggen wrote:
> Ok, I am attempting to append to the middle of a file. I am not
> interested in appending to the end I know how to do that. Here is what
> I have
part of user add script)
>
> tail -55 ftpaccess > efile
> fgrep -v -f efile ftpaccess > sfile
>
> What happens is that sfile has no output in it, it is empty which
> drive me insane becaue this works with every file I have tried except
> ftpaccess.
What are you trying to do again? "fgrep" wants to find a matching pattern,
and you're providing an entire file of patterns for it to match. This is
going to run very slowly, because each of the lines in the pattern file has
to be matched sequentially with each of the lines in the data file until a
match is found. In other words, the search time increases as the number of
lines in the pattern file TIMES the number of lines in the target file.
There are MUCH easier, faster ways to accomplish anything you can name.
Apart from the fact that your method doesn't work reliably.
Instead of trying to explain your solution, just tell us what you want to
do, and why.
Perl, as just one example, can split a file on an arbitrary search pattern,
and you could use this property to insert any arbitrary length of insertion
text at the location of the pattern match, creating the insertion you
apparently want -- but MUCH more efficiently than the above.
--
Paul Lutus
http://www.arachnoid.com