View Single Post

  #1 (permalink)  
Old 05-23-2006, 04:45 PM
warren warren is offline
Member
User
 
Join Date: Jun 2005
Posts: 45
Rep Power: 0
warren
Default How can I get some specific characters of dd command output

Hi all!,

---here is my sample script----
echo "Enter the size of the file to be created: "
read size
echo "How many files will be created? "
read quantity
i=1
while [ $i -le $quantity ]
do
dd if=/dev/zero of=file$i bs=1M count=$size 2> /dev/null
echo "File$i created...."
i=`expr $i + 1`
done

the output is
File1 created....
File2 created....

here is the output of dd command:
dd if=/dev/zero of=file1 bs=1M count=1
3+0 records in
3+0 records out
3145728 bytes (3.1 MB) copied, 0.088105 seconds, 35.7 MB/s

How can I get the character "35.7 MB/s" or maybe the whole 3rd line and then I can append this to the output of the script.
like:
File1 created....35.7 MB/s
File2 created....35.7 MB/s

thanks for any help....
warren
Reply With Quote