LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-23-2014, 02:53 PM   #1
nameprabhat
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Rep: Reputation: Disabled
Wink Need lines with most inforamtions in them


my file is below:

1)prabhat,,"admin","","","",,,,,"",,
2)prabhat,,"admin","user","window","linux",,,,,"",,
3)shayam,,"admin","","","",,,,,"",,
4)raja,,"admin","user","window","linux",,,,,"",,
5)badam,,"admin","","","",,,,,"",,
6)devam,,"admin","user","window","linux",,,,,"",,

now i need only those rows from this files where name is associated with more roles.
ex: in 1st and 2nd rows name prabhat is same and roles are different. in o/p row 2 should come not row 1.
"" under them their are roles, 1st row contains the name.

If there is only 1 row with name then that should come under outout as well.

Code in perl/shell/awk anything would be helpful!! Thanks.
 
Old 12-23-2014, 03:12 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
what have you tried and where are you stuck ?
 
Old 12-23-2014, 03:30 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Are the numbers and brackets that begin each line part of the file?
 
Old 12-23-2014, 03:55 PM   #4
nameprabhat
LQ Newbie
 
Registered: Jan 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
1)...these are not part of original file i have out here to mention lines separetely.

this was the part of bigger program ..where i come down to this after sorting and finding unique records from different files. now i am able to find any logic to separate these rows.
 
Old 12-24-2014, 02:25 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
As first post has indicated ... where is your attempt and where are you stuck?
 
  


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
[SOLVED] bash: sort lines in 2 files so that equal lines are at the same line number... masavini Programming 10 06-21-2012 01:58 PM
Delete Duplicate Lines in a file, leaving only the unique lines left xmrkite Linux - Software 6 01-14-2010 06:18 PM
Asterisk box to connect VoIP lines with normal telephone lines. sraju Linux - Software 1 11-08-2006 12:38 AM
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 09:19 AM
printer printing vertical lines at beginning and end of lines makhand Linux - Hardware 0 09-02-2005 02:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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