Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Using file lines as "input files"
- X-seq: zsh-users 27875
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Using file lines as "input files"
- Date: Fri, 8 Jul 2022 21:58:26 +0100
- Archived-at: <https://zsh.org/users/27875>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- Reply-to: dominik.vogt@xxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author