Sponsored Content
Top Forums Shell Programming and Scripting Print unique names in a specific column using awk Post 302801459 by quincyjones on Thursday 2nd of May 2013 04:01:00 AM
Old 05-02-2013
Print unique names in a specific column using awk

Is it possible to modify file like this.

1. Remove all the duplicate names in a define column i.e 4th col
2. Count the no.of unique names separated by ";" and print as a 5th col

thanx in advance!!
Q

input

Code:
c1	30	3	Eh2
c10	96	3	Frp
c41	396	3	Ua5;Lop;Kol;Kol
c62	2	30	Fmp;Fmp;Fmp

output

Code:
c1	30	3	Eh2	1
c10	96	3	Frp	1
c41	396	3	Ua5;Lop;Kol	3
c62	2	30	Fmp	1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print column names along with values from SQL

Hi, Can anyone tell me how to print the column name anong with the value from the table in shell script e.g #!/bin/ksh var=`sqlplus scott/tiger << -e set heading off feedback off select * from emp; quit; e` echo $var My output should be; ... (5 Replies)
Discussion started by: thana
5 Replies

2. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

3. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

4. UNIX for Dummies Questions & Answers

Delete rows with unique value for specific column

Hi all I have a file which looks like this 1234|1|Jon|some text|some text 1234|2|Jon|some text|some text 3453|5|Jon|some text|some text 6533|2|Kate|some text|some text 4567|3|Chris|some text|some text 4567|4|Maggie|some text|some text 8764|6|Maggie|some text|some text My third column is my... (9 Replies)
Discussion started by: A-V
9 Replies

5. Shell Programming and Scripting

Print unique names in each row of a specific column using awk

Is it possible to remove redundant names in the 4th column? input cqWE 100 200 singapore;singapore AZO 300 400 brazil;america;germany;ireland;germany .... .... output cqWE 100 200 singapore AZO 300 400 brazil;america;germany;ireland (4 Replies)
Discussion started by: quincyjones
4 Replies

6. Shell Programming and Scripting

Extract lines with unique value using a specific column

Hi there, I need a help with extracting data from tab delimited file which look like this #CHROM POS ID REF ALT Human Cow Dog Mouse Lizard chr2 3033 . G C 0/0 0/0 0/0 1/1 0/0 chr3 35040 . G T 0/0 0/0 ./. 1/1 0/1 chr4 60584 . T G 1/1 1/1 0/1 1/1 0/0 chr10 7147815 . G A 0/0 1/1 0/0 0/0... (9 Replies)
Discussion started by: houkto
9 Replies

7. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

8. Programming

Query to SELECT only Column Names that Contain a Specific String?

Hey Guys, I'm using SQuirreL SQL v3.5 GUI to fetch some data that I need for something I'm working on. I'm also using the IBM Informix Driver (*Version 3.5) to connect to the Database. What I want to do, if it's even possible, is to show all COLUMNS if they contain the word "Email". So in... (2 Replies)
Discussion started by: mrm5102
2 Replies

9. Shell Programming and Scripting

Count frequency of unique values in specific column

Hi, I have tab-deliminated data similar to the following: dot is-big 2 dot is-round 3 dot is-gray 4 cat is-big 3 hot in-summer 5 I want to count the frequency of each individual "unique" value in the 1st column. Thus, the desired output would be as follows: dot 3 cat 1 hot 1 is... (5 Replies)
Discussion started by: owwow14
5 Replies

10. Shell Programming and Scripting

How to print multiple specific column after a specific word?

Hello.... Pls help me (and sorry my english) :) So I have a file (test.txt) with 1 long line.... for example: isgc jsfh udgf osff 8462 error iwzr 653 idchisfb isfbisfb sihfjfeb isfhsi gcz eifh How to print after the "error" word the 2nd 4th 5th and 7th word?? output well be: 653 isfbisfb... (2 Replies)
Discussion started by: marvinandco
2 Replies
DateTime::Locale::st(3) 				User Contributed Perl Documentation				   DateTime::Locale::st(3)

NAME
DateTime::Locale::st SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'st' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Southern Sotho. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) Mmantaha Labobedi Laboraru Labone Labohlane Moqebelo Sontaha Abbreviated (format) Mma Bed Rar Ne Hla Moq Son Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) Mmantaha Labobedi Laboraru Labone Labohlane Moqebelo Sontaha Abbreviated (stand-alone) Mma Bed Rar Ne Hla Moq Son Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) Phesekgong Hlakola Hlakubele Mmese Motsheanong Phupjane Phupu Phata Leotshe Mphalane Pundungwane Tshitwe Abbreviated (format) Phe Kol Ube Mme Mot Jan Upu Pha Leo Mph Pun Tsh Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) Phesekgong Hlakola Hlakubele Mmese Motsheanong Phupjane Phupu Phata Leotshe Mphalane Pundungwane Tshitwe Abbreviated (stand-alone) Phe Kol Ube Mme Mot Jan Upu Pha Leo Mph Pun Tsh Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BC AD Abbreviated BC AD Narrow BC AD Date Formats Full 2008-02-05T18:30:30 = Labobedi, 2008 Hlakola 05 1995-12-22T09:05:02 = Labohlane, 1995 Tshitwe 22 -0010-09-15T04:44:23 = Moqebelo, -10 Leotshe 15 Long 2008-02-05T18:30:30 = 2008 Hlakola 5 1995-12-22T09:05:02 = 1995 Tshitwe 22 -0010-09-15T04:44:23 = -10 Leotshe 15 Medium 2008-02-05T18:30:30 = 2008 Kol 5 1995-12-22T09:05:02 = 1995 Tsh 22 -0010-09-15T04:44:23 = -10 Leo 15 Short 2008-02-05T18:30:30 = 08/02/05 1995-12-22T09:05:02 = 95/12/22 -0010-09-15T04:44:23 = -10/09/15 Default 2008-02-05T18:30:30 = 2008 Kol 5 1995-12-22T09:05:02 = 1995 Tsh 22 -0010-09-15T04:44:23 = -10 Leo 15 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = Labobedi, 2008 Hlakola 05 18:30:30 UTC 1995-12-22T09:05:02 = Labohlane, 1995 Tshitwe 22 09:05:02 UTC -0010-09-15T04:44:23 = Moqebelo, -10 Leotshe 15 04:44:23 UTC Long 2008-02-05T18:30:30 = 2008 Hlakola 5 18:30:30 UTC 1995-12-22T09:05:02 = 1995 Tshitwe 22 09:05:02 UTC -0010-09-15T04:44:23 = -10 Leotshe 15 04:44:23 UTC Medium 2008-02-05T18:30:30 = 2008 Kol 5 18:30:30 1995-12-22T09:05:02 = 1995 Tsh 22 09:05:02 -0010-09-15T04:44:23 = -10 Leo 15 04:44:23 Short 2008-02-05T18:30:30 = 08/02/05 18:30 1995-12-22T09:05:02 = 95/12/22 09:05 -0010-09-15T04:44:23 = -10/09/15 04:44 Default 2008-02-05T18:30:30 = 2008 Kol 5 18:30:30 1995-12-22T09:05:02 = 1995 Tsh 22 09:05:02 -0010-09-15T04:44:23 = -10 Leo 15 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 Bed 1995-12-22T09:05:02 = 22 Hla -0010-09-15T04:44:23 = 15 Moq Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = Bed, 2-5 1995-12-22T09:05:02 = Hla, 12-22 -0010-09-15T04:44:23 = Moq, 9-15 MMM (LLL) 2008-02-05T18:30:30 = Kol 1995-12-22T09:05:02 = Tsh -0010-09-15T04:44:23 = Leo MMMd (MMM d) 2008-02-05T18:30:30 = Kol 5 1995-12-22T09:05:02 = Tsh 22 -0010-09-15T04:44:23 = Leo 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Bed Kol 5 1995-12-22T09:05:02 = Hla Tsh 22 -0010-09-15T04:44:23 = Moq Leo 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = Hlakola 5 1995-12-22T09:05:02 = Tshitwe 22 -0010-09-15T04:44:23 = Leotshe 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Bed Hlakola 5 1995-12-22T09:05:02 = Hla Tshitwe 22 -0010-09-15T04:44:23 = Moq Leotshe 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = Bed, 2008-2-5 1995-12-22T09:05:02 = Hla, 1995-12-22 -0010-09-15T04:44:23 = Moq, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Kol 1995-12-22T09:05:02 = 1995 Tsh -0010-09-15T04:44:23 = -10 Leo yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Bed, 2008 Kol 5 1995-12-22T09:05:02 = Hla, 1995 Tsh 22 -0010-09-15T04:44:23 = Moq, -10 Leo 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Hlakola 1995-12-22T09:05:02 = 1995 Tshitwe -0010-09-15T04:44:23 = -10 Leotshe yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week Mmantaha SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::st(3)
All times are GMT -4. The time now is 06:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy