I'm not an expert with sed, but you may want to look into it a bit. This sounds like something you could use it for. Another possibility is to actually split it into two files: Code: head -n 10 file.sql > fileTop
wc -l file.sql
tail -n (number of lines - 10) > fileBottom
That wc line is just there to figure out the number of lines in the file. Then you could edit fileTop and when you're done, just put the files back together. This is by no means an elegant solution, and I'm sure there are better answers, but that's just one way of approaching it.
Another way could be to write a quick Perl script. Just open the the file, use your substitution for the first few lines ($line =~ s/replacingthis/withthis/ if $linenumber < 10  , and then just print the rest of the lines as well.
But hopefully, someone has a better solution, because I want to see it too!
__________________
Registered Linux User: #479567
Asking a question? Read this page first.
Now... sudo make me a sandwich.
ratiocinativeroot.blogspot.com
|