LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

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

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


hey,
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, 02:34 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.
 
  


Reply


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 01:33 AM
how to compare these two files using perl or shell scripting cliffyao Programming 2 03-08-2010 03:23 PM
Shell Scripting : compare two files & append rohits1991 Linux - Newbie 11 05-28-2009 01:11 AM
Simple Scripting Problem [Comparison of several strings] thomasknowles Programming 7 07-22-2008 06:53 AM
Shell script to compare blocks of strings? bruno buys Programming 10 04-15-2006 02:16 PM


All times are GMT -5. The time now is 08:48 AM.

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