zsh-users
 help / color / mirror / code / Atom feed
* Using file lines as "input files"
@ 2022-07-08 20:58 Dominik Vogt
  2022-07-08 21:58 ` Mikael Magnusson
  2022-07-08 22:04 ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: Dominik Vogt @ 2022-07-08 20:58 UTC (permalink / raw)
  To: Zsh Users

Okay, there's this script that calculates a checksum on each line
of a file by reading each line and passing it to
cksum/md5sum/shasum etc.

  cat "$INFILE" | while read LINE; do
          echo "$LINE" | cksum
  done

This takes about four minutes on a file with 265,000 lines because
of the program call overhead.

--

Disclaimer: I _know_ this can be done in seconds with perl /
python, but I like to not rely on scripting languages when the
shell can do the job.

--

So, would it be possible to pass each line in "$INFILE" as a file
argument to "cksum", i.e.

  $ chksum Fline1 Fline2 Fline3 ... Fline265000

(Of course without actually splitting the input file - the point
is to get rid of the four minute wait, not generating more
bottlenecks.)

And there's this open file escriptor limit of 1024 too.  :-)

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-10 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 20:58 Using file lines as "input files" Dominik Vogt
2022-07-08 21:58 ` Mikael Magnusson
2022-07-08 22:04 ` Bart Schaefer
2022-07-08 23:17   ` Dominik Vogt
2022-07-09  2:21     ` Mikael Magnusson
2022-07-10  0:42       ` Dominik Vogt
2022-07-10  0:45         ` Dominik Vogt
2022-07-10  3:27         ` Bart Schaefer
2022-07-10 17:49           ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).