Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-29-2010, 03:25 AM   #1
LQ Newbie
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
in shell scripting how to compare strings from two different simple .txt files

m new in scripting.
can anyone tell what command is to be used to call strings from other files to the script and then comparing strings from two different files in the script to check if strings are matched then return the result to another script.
Old 07-29-2010, 03:34 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
For exact matches on two sorted files look at the "comm" program. It can list 3 columns. Unique in file 1, Unique in file 2 and common to both files. You can suppress columns to return what you want.

For code or generic text files, look at the diff command.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
compare strings in shell scripting culin Linux - General 10 01-24-2013 02:33 AM
how to compare these two files using perl or shell scripting cliffyao Programming 2 03-08-2010 04:23 PM
Shell Scripting : compare two files & append rohits1991 Linux - Newbie 11 05-28-2009 02:11 AM
Simple Scripting Problem [Comparison of several strings] thomasknowles Programming 7 07-22-2008 07:53 AM
Shell script to compare blocks of strings? bruno buys Programming 10 04-15-2006 03:16 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration