LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-26-2008, 02:59 PM   #1
PKrishna
LQ Newbie
 
Registered: Mar 2008
Posts: 10

Rep: Reputation: 0
Question plz help in merging files


Hi I am new to scripting!
Please help me achieve the following.
i have 2 files, inventory and exception

contents of inventory
tokw01 10.15.12.1
lonw01 20.15.13.1
ausw01 30.15.16.1

contents of exception
10.15.12.1 CPU=90%
30.15.16.1 MEM=80%

file alarmed should&only have
tokw01 10.15.12.1 CPU=90%
ausw01 30.15.16.1 MEM=80%

thanks in advance!
-Prem
 
Old 03-26-2008, 04:26 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
What have you tried so far? You can read the file inventory line by line, extract the second field and look for it in the file exception using grep.
 
Old 03-26-2008, 05:25 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Check out the join command.
 
Old 03-27-2008, 02:57 AM   #4
PKrishna
LQ Newbie
 
Registered: Mar 2008
Posts: 10

Original Poster
Rep: Reputation: 0
join worked thanks a ton Matthew!
 
  


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
Merging ,pdf files satimis Linux - General 6 11-21-2007 09:31 PM
Merging Two Files using C++ ckoniecny Programming 5 09-26-2006 10:00 AM
merging mpg files karhu Linux - Software 4 07-28-2005 06:25 AM
merging movie files ZaphyR Linux - Software 4 09-05-2004 09:26 AM
merging files using perl pantera Programming 1 06-03-2004 01:56 PM


All times are GMT -5. The time now is 05:04 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration