Results 1 to 4 of 4
Hi, here is what I'm looking for. I have 5 files in a directory, say file1, file2,...,file5.
I want to read the complete contents of all the 5 files and ...
- 01-10-2012 #1Just Joined!
- Join Date
- Jan 2012
- Posts
- 2
how to capture file read time?
Hi, here is what I'm looking for. I have 5 files in a directory, say file1, file2,...,file5.
I want to read the complete contents of all the 5 files and capture the time it took to read all 5 files.
Basically, I'm trying to do a read performance test with 5 files that shows the time it took to read the 5 files.
Please help...
thanks
- 01-10-2012 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Whatever you mean by "reading the files" is vague, but I assume you know what you need to do there. Just put the command to read the files in a function, then use the bash builtin-in time to tell you how long the entire process took, e.g.:
Code:#!/bin/sh files='file1 file2 file3 file4 file5' readfiles(){ for file in $files; do echo reading file $file # do some command to 'read' the file done } time readfiles
- 01-10-2012 #3Just Joined!
- Join Date
- Jan 2012
- Posts
- 2
by reading, i mean open a file and then close it one by one for all 5 files. how would I do that?
- 01-10-2012 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
if it is a text file, you could simply cat it. if you don't care to see the output, just redirect STDOUT/STDERR to /dev/null, e.g.:
cat file >/dev/null 2>&1


Reply With Quote