Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Remove duplicates from comma separated list Post 303041381 by RudiC on Friday 22nd of November 2019 03:19:07 AM
Old 11-22-2019
Try also
Code:
awk '
        {gsub ($1 "(,|$)", _, $2)
         gsub (/,,/, ",", $2)
         gsub (/^,|,$/, _, $2)
         $1 = $1
        }
$2
' file

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove whitespaces between comma separated fields from file

Hello all, I am a unix dummy. I am trying to remove spaces between fields. I have the file in the following format 12332432, 2345 , asdfsdf ,100216 , 9999999 12332431, 2341 , asdfsd2 ,100213 , 9999999 &... (2 Replies)
Discussion started by: nitinbjoshi
2 Replies

2. Shell Programming and Scripting

Need comma separated processing

I have a file like this OUTLN OPEN Y SCOTT OPEN N USER4 OPEN Y DBSNMP EXPIRED & LOCKED N ... (4 Replies)
Discussion started by: ilugopal
4 Replies

3. Shell Programming and Scripting

Help parse comma separated list

I have a list of files with the same name, but they have a different date stamp in the name. I can find the first file, but I need to find the second file. I am using this information to create a variable I use later. Here is a example of how I find the first file. "ls -mr... (11 Replies)
Discussion started by: NoMadBanker
11 Replies

4. Shell Programming and Scripting

Output of command in comma separated list

Hi; I have an output of a particular command say $command fstl:r-x ajay:r-x how can i get this in comma separated list, eg: fstl:r-x,ajay:r-x Thnks; (4 Replies)
Discussion started by: ajaypadvi
4 Replies

5. Shell Programming and Scripting

Need Help - comma inside double quote in comma separated csv,

Hello there, I have a comma separated csv , and all the text field is wrapped by double quote. Issue is some text field contain comma as well inside double quote. so it is difficult to process. Input in the csv file is , 1,234,"abc,12,gh","GH234TY",34 I need output like below,... (8 Replies)
Discussion started by: Uttam Maji
8 Replies

6. UNIX for Dummies Questions & Answers

[solved] Comma separated values to space separated

Hi, I have a large number of files which are written as csv (comma-separated values). Does anyone know of simple sed/awk command do achieve this? Thanks! ---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ---------- Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies

7. Shell Programming and Scripting

awk to parse comma separated field and removing comma in between number and double quotes

Hi Experts, Please support I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6. ... (3 Replies)
Discussion started by: as7951
3 Replies

8. Shell Programming and Scripting

Remove duplicates separated by delimiter

First post, been browsing for 3 days and came out with nothing so far. M3 C2 V5 D5 HH:FF A1-A2,A5-A6,A1-A2,A1-4 B4-B6,B2-B4,B4-B6,B1-B2output should be M3 C2 V5 D5 HH:FF A1-A2,A5-A6,A1-A4 B2-B4,B4-B6,B1-B2On col 6 and 7 there are strings in form of Ax-Ax and Bx-Bx respectively. Each string are... (9 Replies)
Discussion started by: enrikS
9 Replies

9. UNIX for Beginners Questions & Answers

How to extract fields from a CSV i.e comma separated where some of the fields having comma as value?

can anyone help me!!!! How to I parse the CSV file file name : abc.csv (csv file) The above file containing data like abv,sfs,,hju,',',jkk wff,fst,,rgr,',',rgr ere,edf,erg,',',rgr,rgr I have a requirement like i have to extract different field and assign them into different... (4 Replies)
Discussion started by: J.Jena
4 Replies
package-cleanup(1)														package-cleanup(1)

NAME
package-cleanup - clean up locally installed, duplicate, or orphaned packages SYNOPSIS
package-cleanup [options] <item ...> DESCRIPTION
package-cleanup is a program for cleaning up the locally-installed RPMs. GENERAL OPTIONS
-c <config file> Use alternative config file (default is /etc/yum.conf). -h, --help Help; display a help message and then quit. -q, --quiet Print out nothing unnecessary. -v, --version Report program version and exit. -y Agree to anything asked. --leaves List leaf nodes in the local RPM database. Leaf nodes are RPMs that are not relied upon by any other RPM. --orphans List installed packages which are not available from currently configured repositories. This is identical to "yum list extras", which may provide better output. --oldkernels Remove old kernel and kernel-devel packages. --problems List dependency problems in the local RPM database. If any problems are found it will exit with an exit code of 1. --dupes Scan for duplicates in the local RPM database. --cleandupes Scan for duplicates in the local RPM database and clean out the older versions. --count <COUNT> Number of duplicate/kernel packages to keep on the system (default 2) LEAVES OPTIONS
--all When listing leaf nodes also list leaf nodes that are not libraries. --leaf-regex A package name that matches this regular expression will be considered a leaf. --exclude-devel When listing leaf nodes do not list development packages. --exclude-bin When listing leaf nodes do not list packages with files in bin directories. OLDKERNELS OPTIONS
--keepdevel Do not remove kernel-devel packages when removing kernels EXAMPLES
List all dependency problems: package-cleanup --problems List all packages that are not in any Yum repository: package-cleanup --orphans Remove old kernels keeping 3 and leaving old kernel-devel packages installed: package-cleanup --oldkernels --count=3 --keepdevel List all leaf packages with no files in a bin directory whose name begins with either 'perl' or 'python': package-cleanup --leaves --exclude-bin --leaf-regex="^(perl)|(python)" FILES
As package-cleanup uses YUM libraries for retrieving all the information, it relies on YUM configuration for its default values like which repositories to use. Consult YUM documentation for details: /etc/yum.conf /etc/yum/repos.d/ /var/cache/yum/ SEE ALSO
yum.conf (5) http://yum.baseurl.org/ AUTHORS
See the Authors file included with this program. BUGS
There are of course no bugs, but should you find any, you should first consult the FAQ section on http://yum.baseurl.org/wiki/Faq and if unsuccessful in finding a resolution contact the mailing list: yum-devel@lists.baseurl.org. To file a bug use http://bugzilla.redhat.com for Fedora/RHEL/Centos related bugs and http://yum.baseurl.org/report for all other bugs. Gijs Hollestelle 03 November 2005 package-cleanup(1)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy