friedkiwi
friedkiwi

Reputation: 2198

Get latest 100MB Of text file in linux

How do I get the latest 100MB from a text log on Linux? Is there a tool for it, or could you point me on a script?

I have no programming experience on Shell Scripting, Perl or Python, and I don't want to install mono so I can write it in C#.

Thanks!!

Yvan Janssens

Upvotes: 6

Views: 3058

Answers (2)

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181290

Use tail:

$ tail -c 104857600 your_file_name

Where 104857600 is 100MB in bytes.

Or:

$ tail -b 204800 your_file_name

Where 204800 is size in 512-byte block.

Upvotes: 2

Colin Hebert
Colin Hebert

Reputation: 93177

You can try this :

tail -c 104857600 yourFile

or if you're more confortable:

tail -c $[1024*1024*100] yourFile

Resources :

Upvotes: 11

Related Questions