LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-27-2011, 11:39 AM   #1
dzounar
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
[Noob] Merging line of a file for consolidation...


Hi there,

I was wondering if somebody has already got this tricky one. I'm trying to consolidate a huge CSV file with a lot of values so server comparison. This file is similar to the example below:

server1;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0

server2;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0

server2;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0

server3;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0

server3;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0

server3;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0

server4;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0


As you can see, in server2 example, I need to merge all the occurrences of it replacing all zero values with a non zero value where applicable.

Not sure if I made myself clear. Any clues?
 
Old 09-27-2011, 12:46 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,496

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
ummmm .. huh?? Is the idea that once you have run something over this file each server will only have a single entry where all the '1' values should prevail over a '0'?
 
Old 09-27-2011, 12:56 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
I think OP is saying he wants to do a bitwise OR on a per-colum basis (for matching server #s). So:
Code:
server5;0;0;1;0
server5;1;1;1;0
Would compute to:
Code:
server5;1;1;1;0
Sounds like homework.
 
  


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
Small Help required for merging two files per line!!! rockf1bull Red Hat 4 10-05-2011 08:06 AM
Merging 4 files into a single file sudheerkappala Linux - General 3 10-27-2008 02:07 AM
XML File merging shourya21 Linux - Newbie 0 01-29-2008 09:15 AM
Merging gifs into printable file jackassjim Linux - Software 2 03-28-2005 01:51 PM
WP for cmd-line data merging & printing? MikHud Linux - Software 0 11-06-2002 02:36 AM


All times are GMT -5. The time now is 09:50 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