I need help on Unix command or script. I need to two compare two files as follows: - file1 contains 500 recs file2 contain 1500 recs
I need to get the different between file 1 & 2 and to be writen 1000 recs in file3. but the tricky is the in both files don't want to compare the whole line. the line length of 640 and I want to compare only 630 length.
run either a more advanced script (awk or perl) or write a Java program to do the work for you.
Or of course a C/C++ app if you have the resources to do so. Java has such large overheads on startup and memory consumption that it usually isn't suited for these sorts of small, fast jobs (it is however excellent for portable long running processes where RAM isn't a constraint). Whenever I have to parse a lot of files in some custom way, it's always faster (than grep, awk and certainly perl) to write a native program to do it. I'll use a shell script if the files are small and I need a quick or rapidly portable solution, but it's C/C++ otherwise... Compiling on Linux is dead easy too---just install gcc/g++ via your package manager and run it on the source files. It's almost as easy on Windows with MinGW, but programming with VC++/VS is quite a different experience.
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
subject: Command to compare two files starting from first line till Mid