sort shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sort shell
# 1  
Old 12-02-2010
sort shell

Hello,
reéaliser I'd like a program that sorts the entries in a directory under different options:

-R: Sorting the contents of the directory tree starting at pos. In this case we will sort with respect to the names of the entries but it will show the path;

-D: sort in descending order by default the sorting is done in ascending order;

-Nsdletpg: You can specify the sorting criterion used. these criteria can be combined, in this case if two files are identical to the first criterion, the second criterion the départegera and so on;

-N: sorting after the name of the entries;
-S: sort according to size of entries;
-M: sort of the date of last modification of entries;
-L: sorting by number of line entries;
-E: sorting following the expansion of entries "characters found after the last name of the entries;
-T: sort according to file type (order: directory, files, links, block special file dee, character special file, named pipe, socket)

-P: sorting according to the owner of the entry

G-sorting according to the group owner's entry.

I give a small example of Result when should have:

sortshell -d - r - pse /home sort , descending order, tree starting at / home owners based on entries as the first criterion, the size of entries as the second criterion and the expansion of entries last criterion.

ps: we have no right to use ls or sorts
thank you to all who can help me
# 2  
Old 12-02-2010
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to sort a content of a text file using a shell script?

I am new to shell scripting. I am interested how to know how to sort a content of a file using shell scripting. I've attached the 'Input file' and the 'expected output' to this thread. Details provided in the expected output file will provide details on how the sort needs to be done. ... (16 Replies)
Discussion started by: nkarthik_mnnit
16 Replies

2. Shell Programming and Scripting

How to sort the timestamp in the filename in shell script?

originally the shellscript #ln_file_name=`echo $ld_interface_date"_"${8}".csv"` #ln_file_name=`echo 201202011527_HL_HLTM1_B04A.csv` ln_file_name="*"`echo ${7}".csv"` get_file_list_1=$log_path"tm1_file_list.gfl1" cd ${source_path} echo "Try to find any file exist in the... (10 Replies)
Discussion started by: feilhk
10 Replies

3. Homework & Coursework Questions

Shell script/awk to sort text

1. The problem statement, all variables and given/known data: I have a file with a fragment of a novel, which I have to clear from punctuation and sort all the words contained one per line and non duplicated, all this going to a file called "palabras". Here is fragment of the input file: ... (4 Replies)
Discussion started by: ektorzoza
4 Replies

4. Shell Programming and Scripting

shell script to sort information in one file

Hi to all, anyway to create shell script to sort informations from one file and create new file with the sorted values? from file 30days.out -bash-3.00# more 30days.out user/str4@kl.com/INBOX user/tg1@johor.com/INBOX user/tg2@kedah.com/INBOX user/tg3@titangroup.com/INBOX... (3 Replies)
Discussion started by: Mr_47
3 Replies

5. Shell Programming and Scripting

sort shell?

hello my problem is that I have to do diferents sorts shells with diferents logical algorithms like shell sort, select sort, quick sort and bubble sort. starting from a basic shell that says something like: file = cat $1 sortLogic = $2 colSort = $3 source sortLogic file colSort > $4 ... (1 Reply)
Discussion started by: edgar287
1 Replies

6. Shell Programming and Scripting

shell script to sort the 5th column

hi folks, I have this data in a data.txt file and i want to sort the 5th column and in descending order: Jun 15 119.167.247.40 = 23 Jun 15 119.167.247.40 = 3 Jun 15 208.115.46.125 = 12 Jun 15 208.115.46.125 = 6 Jun 15 210.51.10.160 = 20 I want this sample output: Jun... (2 Replies)
Discussion started by: linuxgeek
2 Replies

7. UNIX for Dummies Questions & Answers

shell: reconcile language and sort behaviour

Hi Don't know if this is a dummy question, but let's give it a try. I yesterday had a problem with undefined behaviour in the sort shell command (I'm using bash), leading to different sort orders without apparent reasons. I resolved this by typing export LC_ALL="C" export LC_COLLATE="C"... (5 Replies)
Discussion started by: jossojjos
5 Replies

8. Shell Programming and Scripting

how to get some sort of graphics using shell scripts?

Hi all, I would like to know how to have graphics embedded using shell scripts... I mean simple =========> or ---------> would do... The main idea here is for every element of the bar to move for every % completion of data..... I tried echo under a for loop ,but it was not giving me o/p that... (3 Replies)
Discussion started by: wrapster
3 Replies

9. Shell Programming and Scripting

Unable to use sort command in Shell Script

Hello All, I am creating a shell script that reads a file(test.txt) with the following data, 0.0.0.0 10.10.10.0 10.10.10.1 10.10.10.10 10.10.10.2 10.10.10.3 10.10.10.4 10.10.10.5 10.10.10.6 10.10.10.7 10.10.10.8 10.10.10.9 If I use the sort, the highest value I am getting is... (1 Reply)
Discussion started by: racbern
1 Replies

10. Programming

comb/shell sort

Hi all, Can someone explain to me how shell sort works and tell me why it can not be used on linked lists. Thanks (8 Replies)
Discussion started by: newbietoIT
8 Replies
Login or Register to Ask a Question