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.

"tail -1 <file_name>"

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 :slight_smile:

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

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.

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

A ton of thanks

sort filename |tail -1