terminal find file with latest patch number
up vote
-3
down vote
favorite
I have a folder with a lot of patch files with pattern
1.1.hotfix1
1.2.hotfix2
2.1.hotfix1
2.1.hotfix2 ...etc
and I have to find out the latest patch(2.1.hotfix2
should be the result of the example) with a bash
how can i achieve it?
bash shell command-line
New contributor
add a comment |
up vote
-3
down vote
favorite
I have a folder with a lot of patch files with pattern
1.1.hotfix1
1.2.hotfix2
2.1.hotfix1
2.1.hotfix2 ...etc
and I have to find out the latest patch(2.1.hotfix2
should be the result of the example) with a bash
how can i achieve it?
bash shell command-line
New contributor
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I have a folder with a lot of patch files with pattern
1.1.hotfix1
1.2.hotfix2
2.1.hotfix1
2.1.hotfix2 ...etc
and I have to find out the latest patch(2.1.hotfix2
should be the result of the example) with a bash
how can i achieve it?
bash shell command-line
New contributor
I have a folder with a lot of patch files with pattern
1.1.hotfix1
1.2.hotfix2
2.1.hotfix1
2.1.hotfix2 ...etc
and I have to find out the latest patch(2.1.hotfix2
should be the result of the example) with a bash
how can i achieve it?
bash shell command-line
bash shell command-line
New contributor
New contributor
New contributor
asked 11 hours ago
Jamil
32
32
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Reverse order all files by time and print the first line.
In case you have some other files then you can print files having hotfix text only.
ls -t1 *hotfix* | head -n 1
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
add a comment |
up vote
1
down vote
You can use find
with regex, and take the last line from sort
:
find * -type f -regex "^[^d]+.[^d]+.hotfix[^d]+$" | sort | tail -1
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Reverse order all files by time and print the first line.
In case you have some other files then you can print files having hotfix text only.
ls -t1 *hotfix* | head -n 1
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
add a comment |
up vote
2
down vote
accepted
Reverse order all files by time and print the first line.
In case you have some other files then you can print files having hotfix text only.
ls -t1 *hotfix* | head -n 1
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Reverse order all files by time and print the first line.
In case you have some other files then you can print files having hotfix text only.
ls -t1 *hotfix* | head -n 1
Reverse order all files by time and print the first line.
In case you have some other files then you can print files having hotfix text only.
ls -t1 *hotfix* | head -n 1
edited 11 hours ago
answered 11 hours ago
Chintamani Manjare
3961214
3961214
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
add a comment |
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
is it possible to find it out without using the modified time? because sometimes I'm not sure if it must be the last modified one
– Jamil
10 hours ago
add a comment |
up vote
1
down vote
You can use find
with regex, and take the last line from sort
:
find * -type f -regex "^[^d]+.[^d]+.hotfix[^d]+$" | sort | tail -1
add a comment |
up vote
1
down vote
You can use find
with regex, and take the last line from sort
:
find * -type f -regex "^[^d]+.[^d]+.hotfix[^d]+$" | sort | tail -1
add a comment |
up vote
1
down vote
up vote
1
down vote
You can use find
with regex, and take the last line from sort
:
find * -type f -regex "^[^d]+.[^d]+.hotfix[^d]+$" | sort | tail -1
You can use find
with regex, and take the last line from sort
:
find * -type f -regex "^[^d]+.[^d]+.hotfix[^d]+$" | sort | tail -1
edited 10 hours ago
answered 11 hours ago
RoadRunner
8,77531137
8,77531137
add a comment |
add a comment |
Jamil is a new contributor. Be nice, and check out our Code of Conduct.
Jamil is a new contributor. Be nice, and check out our Code of Conduct.
Jamil is a new contributor. Be nice, and check out our Code of Conduct.
Jamil is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371880%2fterminal-find-file-with-latest-patch-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown