Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
Linux combine sort files by date created and given file name

I need to combine these to commands in order to have a sorted list by date created with the specified "filename".

I know that sorting files by date can be achieved with:

ls -lrt

and finding a file by name with

find . -name "filename*"

I don't know how to combine these two. I tried with a pipeline but I don't get the right result.

[EDIT] Not sorted enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

find . -name "filename" -printf '%TY:%Tm:%Td %TH:%Tm %h/%f\n' | sort

Forget xargs. "Find" and "sort" are all the tools you need.

over 4 years ago · Santiago Trujillo Relatório

0

My best guess would be to use xargs:

find . -name 'filename*' -print0 | xargs -0 /bin/ls -ltr

There's an upper limit on the number of arguments, but it shouldn't be a problem unless they occupy more than 32kB (read more here), in which case you will get blocks of sorted files :)

over 4 years ago · Santiago Trujillo Relatório

0

find . -name "filename" -exec ls --full-time \{\} \; | cut -d' ' -f7- | sort

You might have to adjust the cut command depending on what your version of ls outputs.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda