Skip to content

This is a DSA project which works like the utility command 'sort' in Linux. The program makes use of external sorting algorithm which makes it possible to sort files larger than the primary memory.

Notifications You must be signed in to change notification settings

AnupNair08/Sort-Command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sort Command

This is a C program to simulate the Linux Sort Command and it works on the External Merge Sort Algorithm.

Primary use cases include sorting of files beyond the primary memory and additional options to sort based on order.

Functioning of the algorithm

  1. Reads an input file from the user and splits into smaller parts readable in the main memory.
  2. Uses Merge Sort for sorting the smaller parts and store them on the secondary memory.
  3. Run the merging of the sorted files and combine the output into a single file.

To run this project

Clone the repository

#Build the project
make

#Run the program
Run ./a.out [option] filename [filename]

Usage

    Run the following commands to get started with the tool

    ./configure
    make
    sudo make install

    cd src && ./mysort.o filename [options]

Options available

-r The default order of sorting is ascending. Use this flag to sort in descending order

-b Sort lines by ignoring the leading blank spaces

-o Store the output of the result in a file specified as a parameter

-f Ignore the case of the aplhabets on sorting.

-d Sort based on dictionary order

-n Sort based on numerical values

-m Merges files specified as operands in a sorted order

-u Prints out the unique lines in the sorted file

-nr Numeric reverse sort

-i Sort by ignoring non printable characters

-k Sorts by the . delimiter

About

This is a DSA project which works like the utility command 'sort' in Linux. The program makes use of external sorting algorithm which makes it possible to sort files larger than the primary memory.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages