LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2008, 11:18 PM   #1
pooppp
Member
 
Registered: May 2008
Posts: 32

Rep: Reputation: 15
Comparing two files to get matched contents in another file using shell script


File a & file b is the input file & file c is o/p file
How to compare filea & fileb
-------------------------

file a

1
2
3
4
--------------------

file b

a
b
1
2
3
g
------------------

result file c

1
2
3
----------------
Help me
 
Old 08-04-2008, 11:28 PM   #2
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Bullseye
Posts: 357

Rep: Reputation: 49
######### file a
$ cat a
1
2
3
4

########file b
$ cat b
a
b
1
2
3
######### command
$ grep -f b a
1
2
3
 
Old 08-05-2008, 12:05 AM   #3
pooppp
Member
 
Registered: May 2008
Posts: 32

Original Poster
Rep: Reputation: 15
Command is not required..can u write script for above one?

Plz anyone Help me.........

Last edited by pooppp; 08-05-2008 at 12:36 AM.
 
Old 08-05-2008, 12:11 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
This looks a lot like homework, and it's certainly a double post

http://www.linuxquestions.org/questi...script-660343/

Last edited by billymayday; 08-05-2008 at 12:12 AM.
 
  


Reply



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
shell script to move files from one system to another sytem with file names in a txt coral_km Linux - Newbie 3 02-13-2008 10:23 PM
comparing 2 strings in shell script dhanabalanb Programming 3 08-01-2007 01:17 PM
Shell script for comparing certain lines in two files mou5e Linux - Newbie 9 06-06-2007 01:40 PM
Comparing files contents? hhegab Linux - Newbie 3 07-01-2004 12:45 AM
Comparing file sizes using a bash script. IanChristie Programming 5 12-19-2003 10:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:50 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration