Utility to delete lines from a file ?

  • Thread starter Thread starter flahmeshess
  • Start date Start date
F

flahmeshess

I need to automate a process to delete the first 3 lines from a file.
What is a good command line utility that can do that ? Thanks in
advance.
 
In
flahmeshess said:
I need to automate a process to delete the first 3 lines from a file.
What is a good command line utility that can do that ? Thanks in
advance.

is this a text file?
 
Why I need to automate this is that I needed to compare 2 files. The
first one has 3 additional lines at the top. After the first 3 lines,
the rest should be IDENTICAL (sorry, I did not explain this earlier).

The problem is that the files has TAB characters inside and MORE
expands them. I can't find a switch where they are not expanded. So
the compare using comp fails.

My work around is that I also run the 2nd file using MORE to expand
the TAB also. But this is really a compromise cause I want to compare
the actual files.

Any other possible solutions ? By the way, thanks everybody for the
answer. Ingenious !
 
I thought of something. MORE would have a "-- More --" at the end of
a full screen and pause waiting for input. How do I overcome this if
my text file is more than 1 page ? Thanks again.
 
I think your requirements are beyond the scope of
plain batch files. Here are some options:
- Use Google to find a suitable tool on the net. Check
for "Command Line Editor".
- Write something in Perl.
- Write a dedicated tool in C++.
- If you have exhausted the above options without
finding something suitable, ask me for a copy of my own
multi-purpose tool that I wrote some time ago.
 
Thanks for all your help. I thought of another way to solve this. The
1st 3 lines are standard lines. So what I'll try is instead of
stripping them, I'll do a copy x + y z to insert the 3 lines before
doing a copy ! Why didn't I think of it ! I had this problem for a
while but I keep thinking of removing the 3 lines.

Thanks again.
 
Yes, that's much simpler. And if the lines are standard and
do not occur anywhere else then you could remove them
with find.exe.
 
Back
Top