0

I have a .txt file with the following return:

    01/08/2016  03:19           167.514 test1.txt
    24/07/2016  01:31         2.195.456 test2.txt
    18/09/2015  00:54           106.496 test3.txt
                4 File(s)      2.469.718 bytes

Removing the date and time and the size of the beginning of the line? leaving only the file name?

It would have is thus:

    test1.txt
    test2.txt
    test3.txt
4 File(s)      2.469.718 bytes
Espector
  • 431
  • 2
  • 5
  • 17
  • 3
    `awk '{print $NF}' file` – 123 Aug 01 '16 at 07:10
  • In this way it removes some lines that need are in the last column but are on the line below. Must remove only the date, size and time without affecting my other lines .. – Espector Aug 01 '16 at 07:13
  • 1
    ^^ Your sample data does not contain that. We cannot _guess_ that there are some lines that do not follow the pattern as seen in these 3 lines. – anishsane Aug 01 '16 at 07:15
  • 1
    While this awk one-liner would work for the entries in this file, a suggestion to OP: [Avoid parsing output of ls & similar tools.](http://mywiki.wooledge.org/ParsingLs). You could try to format the file with null terminators for line. – anishsane Aug 01 '16 at 07:16
  • Your sample input is still not complete I guess. This appears like output of `cmd /c dir`. Aren't there header lines too? `Volume in drive C is OS_partition\nVolume Serial Number is 1234-5678` etc? With incomplete data, you will get incomplete answers. – anishsane Aug 01 '16 at 07:27
  • This could work for you: `dir /b && dir | tail -n1`. – anishsane Aug 01 '16 at 07:29

0 Answers0