identy the latest version using shell command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting identy the latest version using shell command
# 1  
Old 03-20-2009
identy the latest version using shell command

Hi,
I have some version number's present in a text file like
version.txt contains
1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
(may be more that this) can we write any specific shell command to find it out the latest version (For this it is 1.0.4 ) ? I am a new user of shell command and cud not make any way out. Please help.Thank you.
# 2  
Old 03-20-2009
"tail -1 <file_name>"
# 3  
Old 03-20-2009
sir,
versiion name not necessarily be in sorted order it may be like
1.0.0
1.0.11
1.0.6
1.1.4
needs to be more generic Smilie
# 4  
Old 03-20-2009
For more info I have the file looks like this way (I am giving the more better look of the file)
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
1.0.9
1.0.0
1.0.1
1.0.10
1.0.11
1.0.2
1.1.1
1.2.1
1.1.2
1.1.3
1.1.4
1.1.5
1.2.2
2.1.0
2.1.1
1.2.5
1.2.4
1.2.3


how to identify ?? the latest version is 2.1.1
# 5  
Old 03-20-2009
Check syntax for your version of unix "sort" command - there is much variation.
The idea is to state that the period is the field delimiter and then sort the three fields in numerical order.

Code:
sort -t\. -k 1n,1n -k 2n,2n -k 3n,3n filename | tail -1

# 6  
Old 03-20-2009
A ton of thanks
# 7  
Old 03-20-2009
sort filename |tail -1
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris 11 SRU latest version

Hi During a host review session I was told to check if the engineers have been updating Solaris 11 OS regularly by verifying the SRU version of the system. However i was having no luck in finding the latest SRU version number in oracle website for hours. I wonder did anyone here know where i... (4 Replies)
Discussion started by: kaze
4 Replies

2. Shell Programming and Scripting

How to Fetch latest version form a file?

Hi, I have a file where versions will be updated, i need to get latest/last updated version from that file. Could you please help? File looks like below - <versions> <version>R20180417.006</version> <version>R20180421.007</version> <version>R20180421.008</version> ... (5 Replies)
Discussion started by: schandra128
5 Replies

3. AIX

Latest firmware version for P770

Dears i have a power7 P770 working in AIX 5.3 TL 11 with frimware AM730_066 is the AM730_066 frimware the latest one or not ? (6 Replies)
Discussion started by: thecobra151
6 Replies

4. Ubuntu

Download latest Ubuntu version from linux command

I have ubuntu 10.4 on my system and want to download newer Ubuntu version like 11.04. Is there any linux command(something like apt-get source used for downloading kernel source) using which I can download directly the newer ubuntu relaease? (2 Replies)
Discussion started by: rupeshkp728
2 Replies

5. BSD

latest version of bsd

Any body there ? What is latest BSD version ? (4 Replies)
Discussion started by: chilaka
4 Replies

6. Shell Programming and Scripting

search latest version of log file

Have checked the forums and couldnt locate help on this. I want to grep a log file for a pattern using a script - I need to grep the latest log file and not sure how I am able to ensure I am greping the latest log file. Here is sample of log files for yestersday and I effectively need to grep... (10 Replies)
Discussion started by: frustrated1
10 Replies

7. Shell Programming and Scripting

Shell Command for finding out Firefox version

Hi I need a shell command for finding out Firefox browser verion on linux machine. Waiting for your reply. Thanks and Regards, Kammy. (0 Replies)
Discussion started by: kjannu
0 Replies

8. Shell Programming and Scripting

Latest version of a file across the servers ..

:o How do I confirm that the script on one server is latest compare to other servers? Is there any script which can tell me the latest version of a file across the servers? Thanks, (2 Replies)
Discussion started by: Sandy
2 Replies

9. UNIX for Dummies Questions & Answers

What is the latest version of Unix?

I want to buy it (2 Replies)
Discussion started by: LANSTARR.COM
2 Replies

10. UNIX for Dummies Questions & Answers

Downloading vs buying latest version of os

I am currently taking a Unix programming class in school, I want ot know which is more efficient and quicker, downloading the os or buying the os (4 Replies)
Discussion started by: lavonte
4 Replies
Login or Register to Ask a Question