Sponsored Content
Top Forums Shell Programming and Scripting Comparing two txt files - pls help Post 302160856 by jisha on Wednesday 23rd of January 2008 01:08:43 AM
Old 01-23-2008
CPU & Memory Comparing two txt files - pls help

Hi,

I have some text files. I need a separate shell say 1.sh in which i can open a particular text file and compare with another txt file. For example:

1.log.txt contains

apple
ball
cat
goat

2.log.txt contains

goat
cat
lion
apple
fox

In my i.sh i need to write script to compare this two files and write the the o/p.The output should be written onto two different files such that one file contains the words that match and another contains the words that do not match.That is after i run 1.sh i should get common.txt and
notcommon.txt


common.txt should contains words present in both(common to both 1.og.txt & 2.log.txt ).i.e;

apple
ca
goat

nocommon.txt should contain the words present only in 2.log.txt and not in 1.log.txt . i.e;
lion
fox

Thanks in advance
JS
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing two files (comm or awk) - help - very urgent pls

I an unix newbie and am confused about the working of "comm". I have two files to be compared and the three columns of output after comparison should be stored a three separate files. File abc -------- pink orange green blue black maroon File xyz --------- pink yellow grey... (3 Replies)
Discussion started by: manthasirisha
3 Replies

2. Shell Programming and Scripting

Comparing two .txt files in shell scripting...

Hi, I have two big .txt files.and i need to compare those two files and redirect it into some other file. If any body wants to resolve this issue then i can send the two text files. Need some quick responce. Thanks, prakash (10 Replies)
Discussion started by: prakash123
10 Replies

3. Solaris

list files .txt and .TXT in one command

Dear experts, In a directory i have both *.TXT and *.txt files. I have a script- for file in `ls *.txt`; do mv $file /tmp/$file How to list both *.txt and*.TXT file in one command so that script will move both .txt or .TXT whatever it find. br//purple (4 Replies)
Discussion started by: thepurple
4 Replies

4. Shell Programming and Scripting

Comparing Strings in 2 .csv/txt files?

EDIT: My problems have been solved thanks to the help of bartus11 and pravin27 This code is just to help me learn. It serves no purpose other than that. Here's a sample csv that I'm working with - #listofpeeps.csv Jackie Chan,1954,M Chuck Norris,1930,M Bruce Lee,1940,M This code is... (13 Replies)
Discussion started by: chickeneaterguy
13 Replies

5. UNIX for Dummies Questions & Answers

Comparing two txt files with AWK

Hi, I need to compare two text files with awk. File1: ------- chr1 43815007 43815009 COSM19193 REF=TG;OBS=AA;ANCHOR=G AMPL495041 chr1 43815008 43815009 COSM18918 REF=G;OBS=T;ANCHOR=T AMPL495041 chr1 115256527 115256528 ... (6 Replies)
Discussion started by: RushiK
6 Replies

6. Shell Programming and Scripting

Comparing two .txt files

i am working on a shell script and need help in the comparing part of it. for e.g. there two text files like this: file1.txt Code: name1 name2 name3 file1 has to be comared with file2 defaultfile.txt Code: name1 name2 (16 Replies)
Discussion started by: draghun9
16 Replies

7. Shell Programming and Scripting

Help pls...Rename .dat files

Hi, I have some .dat files in some directories , i want them to be moved to another directory by changing file names. for ex: cat > /ai/rcmid/feb_files/temp/temp.txt aaa.dat bbb.dat rm -rf main rm -rf a001 rm -rf a002 mkdir main mkdir a001 mkdir a002 touch a001/aaa.dat touch... (1 Reply)
Discussion started by: Ravindra Swan
1 Replies

8. UNIX for Dummies Questions & Answers

Pls. help with script to remove million files

Hi, one of the server, log directory was never cleaned up. We have so many files. I want to remove all the files that starts with dfr* but I get error message when I use the *. rm qfr* bash: /usr/bin/rm: Arg list too long I am trying to write this script but not working. ... (4 Replies)
Discussion started by: samnyc
4 Replies

9. Shell Programming and Scripting

Compare two txt files,mismatches will be in new txt files

Hi, Below are the sample data for txt files. txt file 1 Partnumber|catgroup_id 10001082|46016 10001093|4680 10001093|386003 10001093|463004 10003251|683 10003251|63005 10003252|463005 10003252|4683 10003260|463005 10003260|4683 10003264|4683 10003264|463005 13420000|67... (5 Replies)
Discussion started by: Ankita Talukdar
5 Replies
filebyproc.d(1m)						   USER COMMANDS						  filebyproc.d(1m)

NAME
filebyproc.d - snoop opens by process name. Uses DTrace. SYNOPSIS
filebyproc.d DESCRIPTION
filebyproc.d is a DTrace OneLiner to print file pathnames as they are opened, including the name of the process calling the open. A line will be printed regardless of whether the open is actually successful or not. This is useful to learn which files applications are attempting to open, such as config files, database files, log files, etc. Docs/oneliners.txt and Docs/Examples/oneliners_examples.txt in the DTraceToolkit contain this as a oneliner that can be cut-n-paste to run. Since this uses DTrace, only users with root privileges can run this command. EXAMPLES
This prints new process name and pathnames until Ctrl-C is hit. # filebyproc.d FIELDS
CPU The CPU that recieved the event ID A DTrace probe ID for the event FUNCTION:NAME The DTrace probe name for the event remaining fields The first is the name of the process, the second is the file pathname. DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
filebyproc.d will run forever until Ctrl-C is hit. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
opensnoop(1M), dtrace(1M), truss(1) version 1.00 May 15, 2005 filebyproc.d(1m)
All times are GMT -4. The time now is 02:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy