Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'.
Unfortunately, your sample has only unique second fields so it can't be tested against. Adding a few non-unique lines, this may lead to the desired result:
Dear All,
I want to get help for below case.
I have a file like this.
saman 1
gihan 2
saman 4
ravi 1
ravi 2
so i want to get the result,
saman 5
gihan 2
ravi 3 like this.
Pls help me. (17 Replies)
I have a data set that has 4 columns, I want to know if I can delete duplicate lines while ignoring one of the columns, for example
10 chr1 ASF 30
15 chr1 ASF 20
5 chr1 ASF 30
6 chr2 EBC 15
4 chr2 EBC 30
...
I want to know if I can delete duplicate lines while ignoring column 1, so the... (5 Replies)
Hi Unix gurus,
I have a requirement where I need to find the file count based on unique file names.
OPEN_INV_MMDDYYYY_HHMM.xls
OPEN_INV_MMDDYYYY_HHMM.xls
OPEN_INV_MMDDYYYY_HHMM.xls
CLOSE_INV_MMDDYYYY_HHMM.xls
CLOSE_INV_MMDDYYYY_HHMM.xls
OPEN_INV_MMDDYYYY_HHMM.txt... (2 Replies)
Hi ,
Can You Please let Know How use unix uniq command on a single column for deleting records from file
with Below Structure.Pipe Delimter File .
Source
Name | Account_Id
A | 101
B... (2 Replies)
Hi
My file have 7 column, FIle is pipe delimed
Col1|Col2|col3|Col4|col5|Col6|Col7
I want to find out uniq record count on col3, col4 and col2 ( same order) how can I achieve it.
ex
1|3|A|V|C|1|1
1|3|A|V|C|1|1
1|4|A|V|C|1|1
Output should be
FREQ|A|V|3|2
FREQ|A|V|4|1
Here... (5 Replies)
I met a challenge to filter ~70 millions of sequence rows and I want using awk with conditions:
1) longest string of each pattern in column 2, ignore any sub-string, as the index;
2) all the unique patterns after 1);
3) print the whole row;
input:
1 ABCDEFGHI longest_sequence1
2 ABCDEFGH... (12 Replies)
I want to bring values in the second column into single line for uniq value in the first column.
My input
jvm01, Web 2.0 Feature Pack Library
jvm01, IBM WebSphere JAX-RS
jvm01, Custom01 Shared Library
jvm02, Web 2.0 Feature Pack Library
jvm02, IBM WebSphere JAX-RS
jvm03, Web 2.0 Feature... (10 Replies)
Hi All,
I am trying to output uniq values per column. see file below. can you please assist? Thank you in advance.
cat names
joe allen ibm
joe smith ibm
joe allen google
joe smith google
rachel allen google
desired output is:
joe allen google
rachel smith ibm (5 Replies)
Hi All,
I have a directory and sub-directory that having ‘n' number of .log file in nearly 1GB.
The file is comma separated file. I need to recursively grep and uniq first column values only.
I did in perl. But i wish to know more command line utilities to calculate the time for grep and... (4 Replies)
Hi All,
I have a file like this(having 2 column).
Column 1: like a,b,c....
Column 2: having numbers.
I want to segregate those numbers based on column 1.
Example:
file.
a 5
b 9
b 620
a 710
b 230
a 330
b 1910 (4 Replies)
Discussion started by: Raza Ali
4 Replies
LEARN ABOUT BSD
strcasecmp
STRING(3) Library Functions Manual STRING(3)NAME
strcat, strncat, strcmp, strncmp, strcasecmp, strncasecmp, strcpy, strncpy, strlen, index, rindex - string operations
SYNOPSIS
#include <strings.h>
char *strcat(s, append)
char *s, *append;
char *strncat(s, append, count)
char *s, *append;
int count;
strcmp(s1, s2)
char *s1, *s2;
strncmp(s1, s2, count)
char *s1, *s2;
int count;
strcasecmp(s1, s2)
char *s1, *s2;
strncasecmp(s1, s2, count)
char *s1, *s2;
int count;
char *strcpy(to, from)
char *to, *from;
char *strncpy(to, from, count)
char *to, *from;
int count;
strlen(s)
char *s;
char *index(s, c)
char *s, c;
char *rindex(s, c)
char *s, c;
DESCRIPTION
These functions operate on null-terminated strings. They do not check for overflow of any receiving string.
Strcat appends a copy of string append to the end of string s. Strncat copies at most count characters. Both return a pointer to the null-
terminated result.
Strcmp compares its arguments and returns an integer greater than, equal to, or less than 0, according as s1 is lexicographically greater
than, equal to, or less than s2. Strncmp makes the same comparison but looks at at most count characters. Strcasecmp and strncasecmp are
identical in function, but are case insensitive. The returned lexicographic difference reflects a conversion to lower-case.
Strcpy copies string from to to, stopping after the null character has been moved. Strncpy copies exactly count characters, appending
nulls if from is less than count characters in length; the target may not be null-terminated if the length of from is count or more. Both
return to.
Strlen returns the number of non-null characters in s.
Index (rindex) returns a pointer to the first (last) occurrence of character c in string s or zero if c does not occur in the string. Set-
ting c to NULL works.
4th Berkeley Distribution October 22, 1987 STRING(3)