Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

A pain in the ass of major dimensions. -- C. A. Desoer, on the solution of non-linear circuits


devel / comp.unix.shell / weapons-grade useless use of cat in the wild.

SubjectAuthor
* weapons-grade useless use of cat in the wild.Kaz Kylheku
+- Re: weapons-grade useless use of cat in the wild.Axel Reichert
`* Re: weapons-grade useless use of cat in the wild.D
 `* Re: weapons-grade useless use of cat in the wild.Janis Papanagnou
  `- Re: weapons-grade useless use of cat in the wild.Janis Papanagnou

1
weapons-grade useless use of cat in the wild.

<20240305133318.867@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7635&group=comp.unix.shell#7635

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: weapons-grade useless use of cat in the wild.
Date: Tue, 5 Mar 2024 21:35:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20240305133318.867@kylheku.com>
Injection-Date: Tue, 5 Mar 2024 21:35:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1d42fd5c0f101e603afff72490e9e6f6";
logging-data="4180261"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sR2KA8JFgJkrUSGxjIVb2WjnDd0D3HYw="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:rENYYCkM/oBSf9Q2WpwV4/DNX4Q=
 by: Kaz Kylheku - Tue, 5 Mar 2024 21:35 UTC

https://unix.stackexchange.com/questions/769727/how-do-i-read-the-last-lines-of-a-huge-log-file

"I have a log of 55GB in size.

I tried:

cat logfile.log | tail

But this approach takes a lot of time. Is there any way to read huge
files faster or any other approach?"

:)

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: weapons-grade useless use of cat in the wild.

<878r2w72fj.fsf@axel-reichert.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7636&group=comp.unix.shell#7636

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mail@axel-reichert.de (Axel Reichert)
Newsgroups: comp.unix.shell
Subject: Re: weapons-grade useless use of cat in the wild.
Date: Tue, 05 Mar 2024 23:13:04 +0100
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <878r2w72fj.fsf@axel-reichert.de>
References: <20240305133318.867@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a7c6e38c4924e3e61f944c0022ad4e19";
logging-data="847"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8NLjWFWNNxgq9gWOKc0g/mbJm6cFUD2s="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:xrX3pOQHU+OICITUFZKHl2We74w=
sha1:mhuCydZfSQG+EMPYbKBjLBdTe64=
 by: Axel Reichert - Tue, 5 Mar 2024 22:13 UTC

Kaz Kylheku <433-929-6894@kylheku.com> writes:

> https://unix.stackexchange.com/questions/769727/how-do-i-read-the-last-lines-of-a-huge-log-file
>
> "I have a log of 55GB in size.
>
> I tried:
>
> cat logfile.log | tail
>
> But this approach takes a lot of time. Is there any way to read huge
> files faster or any other approach?"
>
> :)

Nice. A quick test with a 500 MB file gives

real 0m0.296s
user 0m0.059s
sys 0m0.422s

for

time cat foo | tail

and

real 0m0.005s
user 0m0.001s
sys 0m0.008s

for

time tac foo | head

and

real 0m0.005s
user 0m0.005s
sys 0m0.000s

for

time tail foo

Best regards

Axel

Re: weapons-grade useless use of cat in the wild.

<cb4adea8-8204-cfc6-36af-ba9ec2ad20ac@example.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7637&group=comp.unix.shell#7637

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!.POSTED!not-for-mail
From: nospam@example.net (D)
Newsgroups: comp.unix.shell
Subject: Re: weapons-grade useless use of cat in the wild.
Date: Wed, 6 Mar 2024 10:42:00 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <cb4adea8-8204-cfc6-36af-ba9ec2ad20ac@example.net>
References: <20240305133318.867@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII; format=flowed
Injection-Info: i2pn2.org;
logging-data="1035341"; mail-complaints-to="usenet@i2pn2.org";
posting-account="w/4CleFT0XZ6XfSuRJzIySLIA6ECskkHxKUAYDZM66M";
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <20240305133318.867@kylheku.com>
 by: D - Wed, 6 Mar 2024 09:42 UTC

On Tue, 5 Mar 2024, Kaz Kylheku wrote:

> https://unix.stackexchange.com/questions/769727/how-do-i-read-the-last-lines-of-a-huge-log-file
>
> "I have a log of 55GB in size.
>
> I tried:
>
> cat logfile.log | tail
>
> But this approach takes a lot of time. Is there any way to read huge
> files faster or any other approach?"
>
> :)

I would "chunk" it. When I was young I had to analyze several GB of logs
due to a security incident and what I did is to cut up the mega-file in
several chunks, and then do what ever I had to do to those chunks, and
then add the result to one file.

Don't know if that is possible or useful in your situation, but for me,
about 18 years ago, it worked beautifully.

Best regards,
Daniel

Re: weapons-grade useless use of cat in the wild.

<usagdk$j70o$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7644&group=comp.unix.shell#7644

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: weapons-grade useless use of cat in the wild.
Date: Wed, 6 Mar 2024 20:33:07 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <usagdk$j70o$1@dont-email.me>
References: <20240305133318.867@kylheku.com>
<cb4adea8-8204-cfc6-36af-ba9ec2ad20ac@example.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 6 Mar 2024 19:33:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="bcb0347a42901a397ef0116cddf63a39";
logging-data="629784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lE6ky7vWw/ETRUy12+C3D"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:7nUVlVppl8d9uvsPDR1iaqcVu04=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <cb4adea8-8204-cfc6-36af-ba9ec2ad20ac@example.net>
 by: Janis Papanagnou - Wed, 6 Mar 2024 19:33 UTC

On 06.03.2024 10:42, D wrote:
>
>
> On Tue, 5 Mar 2024, Kaz Kylheku wrote:
>
>> https://unix.stackexchange.com/questions/769727/how-do-i-read-the-last-lines-of-a-huge-log-file
>>
>>
>> "I have a log of 55GB in size.
>>
>> I tried:
>>
>> cat logfile.log | tail
>>
>> But this approach takes a lot of time. Is there any way to read huge
>> files faster or any other approach?"
>>
>> :)
>
> I would "chunk" it. When I was young I had to analyze several GB of logs
> due to a security incident and what I did is to cut up the mega-file in
> several chunks, and then do what ever I had to do to those chunks, and
> then add the result to one file.
>
> Don't know if that is possible or useful in your situation, but for me,
> about 18 years ago, it worked beautifully.

The point here is that 'cat' reads the whole file and pipes all
to 'head'. While 'head' is capable of reading the file itself
if called as "tail logfile.log" and can thus directly address
the file from the rear. In other words, you don't need elaborate
sophisticated workarounds, just use tail in a straightforward way.
(Axel posted some timing numbers.)

Janis

>
> Best regards,
> Daniel
>

Re: weapons-grade useless use of cat in the wild.

<usahnm$jfe9$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=7646&group=comp.unix.shell#7646

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: weapons-grade useless use of cat in the wild.
Date: Wed, 6 Mar 2024 20:55:34 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <usahnm$jfe9$1@dont-email.me>
References: <20240305133318.867@kylheku.com>
<cb4adea8-8204-cfc6-36af-ba9ec2ad20ac@example.net>
<usagdk$j70o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 6 Mar 2024 19:55:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="024c656a7db78909e950d23f4a7759c5";
logging-data="638409"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+q5z2gdiQO4rGy+5hI7YP7"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:nF+uIBl95qLP+YSNXMFuwRQkZQA=
In-Reply-To: <usagdk$j70o$1@dont-email.me>
 by: Janis Papanagnou - Wed, 6 Mar 2024 19:55 UTC

On 06.03.2024 20:33, Janis Papanagnou wrote:
> On 06.03.2024 10:42, D wrote:
>>
[...]
>>
>> I would "chunk" it. When I was young I had to analyze several GB of logs
>> due to a security incident and what I did is to cut up the mega-file in
>> several chunks, and then do what ever I had to do to those chunks, and
>> then add the result to one file.
>>
>> Don't know if that is possible or useful in your situation, but for me,
>> about 18 years ago, it worked beautifully.
>
> The point here is that 'cat' reads the whole file and pipes all
> to 'head'. While 'head' is capable of reading the file itself

to 'tail'. While 'tail' is capable of reading the file itself

> if called as "tail logfile.log" and can thus directly address
> the file from the rear. In other words, you don't need elaborate
> sophisticated workarounds, just use tail in a straightforward way.
> (Axel posted some timing numbers.)
>
> Janis
>
>>
>> Best regards,
>> Daniel
>>
>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor