Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I need a help in finding the largest file number in the file pattern. As example, the largest file number is file.153.res in the following file list. file.0.res file.1.res ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    1

    Finding largest file number in the pattern


    Hi,

    I need a help in finding the largest file number in the file pattern.
    As example, the largest file number is file.153.res in the following file list.

    file.0.res
    file.1.res
    file.2.res
    file.3.res
    ...
    file.153.res

    Please let me know what linux script would find the largest pattern.
    Thanks in advance.

    Warm regards,
    Rakesh

  2. #2
    Just Joined!
    Join Date
    Jul 2013
    Posts
    18
    Hi,

    let's say your file list is named list.txt, if you want to find the largest number you have to do this:

    Code:
    cut -d'.' -f2 list.txt | sort | tail -1
    I can provide explanations if you like.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •