Sponsored Content
Full Discussion: sort and compare files
Top Forums UNIX for Dummies Questions & Answers sort and compare files Post 302341595 by dnat on Friday 7th of August 2009 02:38:50 AM
Old 08-07-2009
File A contains
a
b
c
d

File b contains
b
c
a
d

Now i want to compare(cmp or diff) these two files after sorting. Ideally i should get the result that they are same.

---------- Post updated 08-07-09 at 12:08 PM ---------- Previous update was 08-06-09 at 06:16 PM ----------

Does anyone have an answer. What exactly i want to know is how to combine the diff/cmp command with the sort command
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort and compare file

If I have 3 kinds of files in directory DATA1: FileA.20060315.dat, FileB.20060315.dat, FileC.20060315.dat FileC.20060316.dat FileA.20060317.dat, FileB.20060317.dat FileA.20060318.dat, FileB.20060318.dat, FileC.20060318.dat If 3 files have the same date then run $cat FileA.20060315.dat... (3 Replies)
Discussion started by: sabercats
3 Replies

2. Shell Programming and Scripting

Why do we use sort before compare ?

Dear All. Im trying to know how exactly the command "compare" works, does it compare line by line or field by field, and the most important thing is that why the files have to be sorted before we compare them? Thanks in advance (7 Replies)
Discussion started by: yahyaaa
7 Replies

3. Shell Programming and Scripting

Require compare command to compare 4 files

I have four files, I need to compare these files together. As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes. Please suggest if you know some commands whcih can... (6 Replies)
Discussion started by: nehashine
6 Replies

4. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

5. Shell Programming and Scripting

comm command -- Sort and compare two files

Team, I have two files and I am trying to find the lines unique to file1. So i have executed the below command at shell prompt and got the correct results comm -23 <(sort test) <(sort test1) When i run the same command in Bash shell script, i got the correct results. But when i run... (5 Replies)
Discussion started by: forums123456
5 Replies

6. Shell Programming and Scripting

How to sort and compare files in more efficient manner?

Hello All, Iam using below method to sort and compare files. First iam doing sorting and changing the same file and then doing comparing and taking the final result to another file. sort -o temp.txt file1 mv temp.txt file1 sort -o temp.txt file2 mv temp.txt file2 sort -o temp.txt... (6 Replies)
Discussion started by: Vikram_Tanwar12
6 Replies

7. Shell Programming and Scripting

UNIX compare, sort lines and append difference

Hi, I have a file that needs to be converted: content is: a, b, 4 a ,b, 5 x, y, 1 a, b, 1 x, y, 3 how can i get: a, b, 1|4|5 x,y 1|3 (1 Reply)
Discussion started by: nike27
1 Replies

8. Shell Programming and Scripting

UNIX compare, sort lines and append difference

To make it easier, i gave following example. It is not homework or classwork. Instead, i have a huge csv file dump from tsql with 15 columns and around 300 rows. I was able to extract content that needs to be really converted. Here is the extract: ES FP,B1ES FP,70000,I,SL22,SL22 (70000) ES... (0 Replies)
Discussion started by: nike27
0 Replies

9. Shell Programming and Scripting

UNIX compare, sort lines and append difference

To make it easier, i gave following example. It is not homework or classwork. Instead, i have a huge csv file dump from tsql with 15 columns and around 300 rows. I was able to extract content that needs to be really converted. Here is the extract: ES FP,B1ES FP,70000,I,SL22,SL22 (70000) ES... (8 Replies)
Discussion started by: nike27
8 Replies

10. UNIX for Beginners Questions & Answers

Sort by record column, Compare with conditons and export the result

Hello, I am new to Unix and would like to seek a help, please. I have 2 files (file_1 and file_2), I need to perform the following actions. 1 ) Sort the both file by the column 26-36 (which is Invoice number) what is sort command with the column sort? 2) Compare the file_1.sorted and... (3 Replies)
Discussion started by: Usagi
3 Replies
Xapian::Enquire(3pm)					User Contributed Perl Documentation				      Xapian::Enquire(3pm)

NAME
Search::Xapian::Enquire - Make queries against a database DESCRIPTION
This class provides an interface to the information retrieval system for the purpose of searching. METHODS
new set_query takes either a ready made Search::Xapian::Query or a scalar containing a query, which in that case will be passed to Search::Xapian::Query's constructor, together with any other passed arguments. set_query_object <query> get_query matches <start> <size> [<check_at_least>] Takes the start element, and maximum number of elements (and optionally the minimum number of matches to check), and returns an array tied to Search::Xapian::MSet::Tied. get_matching_terms_begin Returns a Search::Xapian::TermIterator, pointing to the start of the stream. get_matching_terms_end Returns a Search::Xapian::TermIterator, pointing to the end of the stream. set_collapse_key <collapse_key> set_docid_order <order> Set the direction in which documents are ordered by document id in the returned MSet. This order only has an effect on documents which would otherwise have equal rank. For a weighted probabilistic match with no sort value, this means documents with equal weight. For a boolean match, with no sort value, this means all documents. And if a sort value is used, this means documents with equal sort value (and also equal weight if ordering on relevance after the sort). order can be ENQ_ASCENDING (the default, docids sort in ascending order), ENQ_DESCENDING (docds sort in descending order), or ENQ_DONT_CARE (docids sort in whatever order is most efficient for the backend.) Note: If you add documents in strict date order, then a boolean search - i.e. set_weighting_scheme(Search::Xapian::BoolWeight->new()) - with set_docid_order(ENQ_DESCENDING) is a very efficient way to perform "sort by date, newest first". set_cutoff <percent_cutoff> [<weight_cutoff>] set_sort_by_relevance Set the sorting to be by relevance only. This is the default. set_sort_by_value <sort_key> [<ascending>] Set the sorting to be by value only. sort_key - value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better. ascending - If true, document values which sort higher by string compare are better. If false, the sort order is reversed. (default true) set_sort_by_value_then_relevance <sort_key> [<ascending>] Set the sorting to be by value, then by relevance for documents with the same value. sort_key - value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better. ascending - If true, document values which sort higher by string compare are better. If false, the sort order is reversed. (default true) set_sort_by_relevance_then_value <sort_key> [<ascending>] Set the sorting to be by relevance then value. Note that with the default BM25 weighting scheme parameters, non-identical documents will rarely have the same weight, so this setting will give very similar results to set_sort_by_relevance(). It becomes more useful with particular BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom weighting schemes. sort_key - value number to reorder on. Sorting is with a string compare. If ascending is true (the default) higher is better; if ascending is false, lower is better. ascending - If true, document values which sort higher by string compare are better. If false, the sort order is reversed. (default true) set_sort_by_key <sorter> [<ascending>] Set the sorting to be by key only. sorter - the functor to use to build the key. ascending - If true, keys which sort higher by string compare are better. If false, the sort order is reversed. (default true) set_sort_by_key_then_relevance <sorter> [<ascending>] Set the sorting to be by key, then by relevance for documents with the same key. sorter - the functor to use to build the key. ascending - If true, keys which sort higher by string compare are better. If false, the sort order is reversed. (default true) set_sort_by_relevance_then_key <sorter> [<ascending>] Set the sorting to be by relevance then key. sorter - the functor to use to build the key. ascending - If true, keys which sort higher by string compare are better. If false, the sort order is reversed. (default true) get_mset Get match set. get_eset <maxitems> <rset> [<decider>] Get set of query expansion terms. get_description Return a description of this object. SEE ALSO
Search::Xapian::Query, Search::Xapian::Database perl v5.14.2 2012-05-09 Xapian::Enquire(3pm)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy