This is a discussion on How can I get some specific characters of dd command output within the Shell scripting forums, part of the Development/Scripting category; Hi all!, ---here is my sample script---- echo "Enter the size of the file to be created: " read size ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
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 |
| Sponsored Links | ||
|
|
|
||||
|
Hmm...
Try as follows (may be in your loop): Code:
(dd if=/dev/zero of=file1 bs=1M count=1) 2>/tmp/fsize.tmp grep copied /tmp/fsize.tmp >/tmp/fsize.tmp
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
|||
|
ok, so we need to create temporary file..
I have here my sample script, its not that good but it works I search the line that contains the character MB then get the last two words. ( dd if=/dev/zero of=file$i bs=1M count=$size ) 2> tmp.txt echo "File$i created..`awk '/MB/ {print}' tmp.txt | awk '{print $8" "$9}'`" my output now is : File1 created...9.5 MB/s its not that useful if the files are small because it will print so fast but in large files, its very useful because you can have an idea about the performance of your system. thanks a lot, warren |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linux shutdown computer specific time | chiku | Linux software | 1 | 04-27-2007 05:53 PM |
| Select specific rows | c341 | Shell scripting | 6 | 01-18-2007 03:04 AM |
| How can I redirect the output of time command to file | warren | Linux software | 13 | 08-25-2006 12:17 PM |
| deleting files created with special characters in solaris | Solaris/OpenSolaris | 1 | 01-11-2006 11:59 PM | |
| Script to extract a specific row of data | ricc | Shell scripting | 1 | 11-15-2005 03:29 PM |