07-13-2011
In this forum, lot and lot of questions having the same scenario.
read about the sort and uniq command.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I have two files and their names are donotcall.txt, filter_it.txt. I want output.txt file with all data that is in filter_it.txt file but not in donotcall.txt. Can anybody help me to write 1-2 lines unix code for this.
donotcall.txt contains following data. Each row represent phone... (3 Replies)
Discussion started by: deep.singh
3 Replies
2. Windows & DOS: Issues & Discussions
Hi All
We have got a text file, which has data dumped from 60 tables.
From these 60 tables of data we need data from 4 tables only.
I tried assigning line numbers to filter out data, but it is not working as intended.
below is the sample file
----Table1-----
3,dfs,43,df
4,sd,5,edd... (18 Replies)
Discussion started by: b_sri
18 Replies
3. UNIX for Dummies Questions & Answers
I have a data file:
abc Text Text Text Unique Text
123 Text word Line Unique Text
fgh Text data Line Unique Text
789 Text Text Line Unique Text
543 Text Text Data Unique Text
and a filter file
123
789
I want to extract out from the data file the two records that contain the keys... (1 Reply)
Discussion started by: tumblez
1 Replies
4. Shell Programming and Scripting
Here is what old matrix look like,
IDs X1 X2 Y1 Y2
10914061 -0.364613333 -0.362922333 0.001691 -0.450094667
10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies
5. Shell Programming and Scripting
hi all,
I have this file with some user data.
example:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies
6. UNIX for Advanced & Expert Users
i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81)
Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in another unix box(say ip adress of the box 10.39.66.82).
Now my... (1 Reply)
Discussion started by: nripa1
1 Replies
7. Shell Programming and Scripting
Hi All ,
I have one file like below ,
Owner name = abu2-kxy-m29.hegen.app
Item_id = AX1981, special_id = *NULL*, version = 1
Created = 09/01/2010 12:56:56 (1283389016)
Enddate = 03/31/2011 00:00:00 (1301554800)
From the above file I need to get the output in the below format ,i need... (3 Replies)
Discussion started by: gnanasekar_beem
3 Replies
8. Shell Programming and Scripting
I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file
11951
11952
74014
11964
11965
11969
11970
11971
11972
60149
74018
74023
86378
11976
11980
11983
11984
11987 (5 Replies)
Discussion started by: pcoj33
5 Replies
9. Shell Programming and Scripting
Hi...
I would like to filter out my data file....in two different way
1st way is like this, I will take one example..here...
The script should ask like this.
Enter min value in first column
Enter max value in first column
Enter min value in second column
Enter max value in... (5 Replies)
Discussion started by: nex_asp
5 Replies
10. UNIX for Dummies Questions & Answers
sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
UNIQ(1) User Commands UNIQ(1)
NAME
uniq - report or omit repeated lines
SYNOPSIS
uniq [OPTION]... [INPUT [OUTPUT]]
DESCRIPTION
Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).
With no options, matching lines are merged to the first occurrence.
Mandatory arguments to long options are mandatory for short options too.
-c, --count
prefix lines by the number of occurrences
-d, --repeated
only print duplicate lines, one for each group
-D print all duplicate lines
--all-repeated[=METHOD]
like -D, but allow separating groups with an empty line; METHOD={none(default),prepend,separate}
-f, --skip-fields=N
avoid comparing the first N fields
--group[=METHOD]
show all items, separating groups with an empty line; METHOD={separate(default),prepend,append,both}
-i, --ignore-case
ignore differences in case when comparing
-s, --skip-chars=N
avoid comparing the first N characters
-u, --unique
only print unique lines
-z, --zero-terminated
line delimiter is NUL, not newline
-w, --check-chars=N
compare no more than N characters in lines
--help display this help and exit
--version
output version information and exit
A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars.
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'. Also, comparisons honor the rules specified by 'LC_COLLATE'.
AUTHOR
Written by Richard M. Stallman and David MacKenzie.
REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report uniq translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
comm(1), join(1), sort(1)
Full documentation at: <http://www.gnu.org/software/coreutils/uniq>
or available locally via: info '(coreutils) uniq invocation'
GNU coreutils 8.28 January 2018 UNIQ(1)