Sponsored Content
Top Forums Shell Programming and Scripting How to sort out the latest one from a series of numbers? Post 302349183 by bhaskar_m on Monday 31st of August 2009 09:22:40 AM
Old 08-31-2009
How to sort out the latest one from a series of numbers?

Hi,

I have a directory which contains a number of sub directories. They are named as 1.0.0, 1.0.1, 1.0.2...1.1.0..1.1.1...1.2.0..and so on..

Basically these are the tags created at the time of release. Tags are named as major.minor.buildnumber format for modules.
Now I have to search the latest tag from different modules.
For example
latest tag between 1.0.0, 1.0.1, 1.0.2 is 1.0.2
latest tag between 1.1.0, 1.1.1, 1.1.2, 1.1.3 is 1.1.3
latest tag between 1.2.0 is 1.2.0 only
latest tag between 2.0.0, 2.0.1 is 2.0.1

I have a command which identifies the latest tag out all these.
Code:
ls -ltr | awk '{print $9}' | sort -t\. -k 1n,1n -k 2n,2n -k 3n,3n

But I need to find out the tags individually for different modules.
Hope I am clear with my requirement. How to proceed any idea? Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to generate a series of numbers

Hi All, I have a requirement where in I have an input as follows:- input=1-4,6,8-10,12-15 I need to explode this range into an output file as follows:- 1 2 3 4 6 8 9 10 12 13 14 15 My input may vary like 1,5-9,11-13,15-17....... (3 Replies)
Discussion started by: rony_daniel
3 Replies

2. Shell Programming and Scripting

sort and semi-duplicate row - keep latest only

I have a pipe delimited file. Key is field 2, date is field 5 (as example, my real file is more complicated of course, but the KEY and DATE are accurate) There can be duplicate rows for a key with different dates. I need to keep only rows with latest date in this case. Example data: ... (4 Replies)
Discussion started by: LisaS
4 Replies

3. Shell Programming and Scripting

script to find filenames with latest version and for all seq. numbers in a day

Hi, We have a requirement to find the set of filenames from the group of files in a specified folder based on (i) version number (ii) sequence number such that, for any given sequence number in a day only the latest version filenames have to indentified. Below is the format of... (4 Replies)
Discussion started by: Deepakbabu
4 Replies

4. Shell Programming and Scripting

How to code a series of numbers in SH

Hi. How can I write this in a shorter way? for NUMs in 1 2 3 4 5 6 I looked at the"seq" command, but I do not think that is what I want. Can I code for NUMs (1..7) Hey!! Is that it? (8 Replies)
Discussion started by: Ccccc
8 Replies

5. Homework & Coursework Questions

Help with shell script to find sum of first n numbers of Fibonacci series

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Shell script to find sum of first n numbers of Fibonacci series 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: Kshitija
0 Replies

6. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

7. UNIX for Dummies Questions & Answers

To find missing numbers from a number series

Hi, My requirement is I have an input file with a continuous series from 10000 to 99999. I have some numbers missing from those series. I want a output file which produces those missing numbers. Eg: 10002, 99999 are missing from the series then the output file should contain those... (4 Replies)
Discussion started by: rakeshbharadwaj
4 Replies

8. Shell Programming and Scripting

Is it Possible to sort a list of hexadecimal numbers using "sort" command?

Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
9 Replies

9. Shell Programming and Scripting

AWK series of numbers

Hi, I have a dataset say 1 2 3 4 5 5 6 7 6 7 8 9 I was wondering if there is a way to add another column with the following style... 1 2 3 4 xyz_1 5 5 6 7 xyz_2 6 7 8 9 xyz_3 It would be greatly appreciated if I can have an option of specifying what to write instead of xyz,... (8 Replies)
Discussion started by: jacobs.smith
8 Replies

10. Shell Programming and Scripting

Moving decimal point in a series of numbers

Hi, i need to move the decimal point from a file listing some numbers like this : 49899.50 49914.55 49894.48 49939.65 49879.44 49919.57 49934.62 49944.67 49954.72 (1 Reply)
Discussion started by: Board27
1 Replies
fatsort(1)						      General Commands Manual							fatsort(1)

NAME
FATSort - FAT filesystem sorting utility SYNOPSIS
fatsort [options] device DESCRIPTION
FATsort sorts directory structures of FAT filesystems. Many MP3 hardware players don't sort files automatically but play them in the order they were transmitted to the device. FATSort can help here. OPTIONS
-c This option causes FATSort to ignore the case of filenames (e.g. 'example.mp3' is equal to 'EXAMPLE.MP3'). -f Force sorting even if the device is mounted or if FATSort cannot determine if the device is mounted. -h Shows some help information. -i Prints some file system information of the specified device. -l FATSort will not sort directory structures, but just print the current order. -o type This options specifies how FATSort will sort files and directories. type can be 'd' for directories before files (which is the default), 'f' for files before directories, or 'a' for no differentiation between files and directories. -n Uses natural order to sort directory structures instead of alphanumeric order. For example, an alphanumeric order would be file123.mp3 file21.mp3 file3.mp3 and the corresponding natural order would be file3.mp3 file21.mp3 file123.mp3. -q FATSort will work quietly without printing additional information messages. -r Sorts the directories in reverse order (Z-A). -R Sorts the directories in random order. -v Shows version information only. The following options can be specified multiple times: -d directory Sort directory only -D directory Sort directory and all subdirectories -x directory Don't sort directory -X directory Don't sort directory and all subdirectories -I prefix Ignore filename prefix prefix during sorting. For example, passing option -I "the " tells FATSort to sort 'The Beatles.mp3' like 'Beatles.mp3'. EXAMPLES
Sort FAT filesystem on an USB stick: fatsort /dev/sda1 Sort FAT filesystem in a file: fatsort /home/user/fat16_fs.img Sort directory /dir1 and all subdirectories except /dir1/dirA: fatsort /dev/sda1 -D /dir1 -x /dir1/dirA Ignore prefixes 'a ' and 'the ' during sorting: fatsort /dev/sda1 -I "a " -I "the " AUTHOR
Boris Leidner <fatsort(at)formenos.de> SEE ALSO
mount(8) fsck(8) NOTES
FAT12 is not supported yet. REPORT BUGS
Please report bugs to fatsort(at)formenos.de. Thanks. FATSort 0.9.15 2011 fatsort(1)
All times are GMT -4. The time now is 12:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy