LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-05-2013, 07:59 PM   #1
sumit.inform
LQ Newbie
 
Registered: Mar 2013
Posts: 19
Blog Entries: 2

Rep: Reputation: Disabled
Post Filtering the input file with certain rules


I have file having follwing input :
1 ABCD : M1-1-74 , A1-9 , M2-1-74 ,
2 EFGH : 4-3-2 , 2-44 , 1-44 ,
3 HIJK : 5-1-13 , 19-2-37 , 6-1-13 , 20-2-37 ,
Output file :
1 ABCD : A1-9 ,M1-1-74 , M2-1-74 ,
2 EFGH : 4-3-2 , 2-44 , 1-44 ,
3 HIJK : 5-1-13 , 6-1-13 , 20-2-37 , 19-2-37 ,

Explanation of output :
1 ABCD : A1-9 ,M1-1-74 , M2-1-74 , ----> i.e common of (M1/M2-1-74) comes together and different A1-9 comes at first.
2 EFGH : 4-3-2 , 2-44 , 1-44 , ----> i.e Common of (1/2-44) comes together and different 4-3-2 comes at first.
3 HIJK : 5-1-13 , 6-1-13 , 20-2-37 , 19-2-37 , --------> i.e Common of 5/6-1-13 comes together and 20/19-2-37 comes together.

Last edited by sumit.inform; 08-05-2013 at 07:59 PM. Reason: Adding More info.
 
Old 08-05-2013, 08:44 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

are you planning to write a program to do this manipulation? Do you have a question?

Cheers,

Evo2.
 
Old 08-06-2013, 09:49 AM   #3
sumit.inform
LQ Newbie
 
Registered: Mar 2013
Posts: 19

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
I have made a script in expect but right now i am taking input by manipulation from Excel , I want this fully automated.
 
Old 08-06-2013, 07:54 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by sumit.inform View Post
I have made a script in expect but right now i am taking input by manipulation from Excel , I want this fully automated.
Ok. I think the easiest approach is to save the file as a csv (or other plain text) and then process that file with a script (without using expect). The script a shell script or could use pure awk or perhaps python or perl. Which language you choose depends on which you are most comfortable with.

If you really want to go the extra mile it is possible to process excel files directly (without exporting to csv). I've used the xlrd and xlwr libraries in python to do this.

Evo2.
 
  


Reply

Tags
shell scripting, tcl



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Audit rules setup and filtering command execution jsm1985 Linux - Server 6 07-18-2013 04:13 AM
filtering MYSQL database input in PHP does not work Latios Programming 1 05-30-2011 09:04 AM
ESSENTIAL FIREWALL RULES for packet filtering studpenguin Linux - Networking 10 12-05-2010 09:06 AM
iptables rules for an ubuntu gateway (filtering connections to and from Internet) Zingaro2002 Linux - Networking 4 05-06-2007 02:01 AM
Adding spamassassin rules when filtering with mimedefang? justanothergeek Linux - Software 0 02-16-2005 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:27 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
Open Source Consulting | Domain Registration