Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Using file lines as "input files"



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