![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Generating files with time interval of fifteen minutes | aajan | Shell Programming and Scripting | 0 | 09-25-2007 01:54 AM |
| command to find out total size of a specific file size (spread over the server) | abhinov | SUN Solaris | 3 | 08-08-2007 06:48 AM |
| Creat a File with a Specific Size | aldowsary | AIX | 3 | 12-14-2006 11:35 AM |
| bash script working for small size files but not for big size files. | davidpreml | Shell Programming and Scripting | 1 | 11-01-2006 11:06 AM |
| How to test for a specific file size | GEBRAUN | UNIX for Dummies Questions & Answers | 1 | 02-20-2006 11:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Generating files of specific size
I've been working on getting a script to take size, dir name and file name variables from an input file and creating the same dir structure along with the file of specific size.
An example of the input file: size/dirname/filename 2100/JAN_06/12345ABC.TCC 2354/FEB_06/24564XYZ.NOS 11240/MAR_06/1212ABAB.NCC I am able to get results with the following code: Code:
#!/bin/sh
set filesize=$1
set dirname=$2
set filename=$3
awk -F/ '{print $1,$2,$3}' os_listing.out | \
while read filesize dirname filename
do
mkdir $dirname
cd $dirname
dd if=test/inputfile of=$filename bs=1 count=$filesize
cd ..
done
What I'm trying to figure out is how to add text of a fixed character length, specifically the file name inside each file when it's created, then have the dd command create the file of specific size. If I use any of the seek options with the dd command, it will just add onto the count size, which results in larger files. Please let me know if additional information is needed. Thank you in advance for any help and support. |
|
||||
|
That works beautifully. Thank you very much for the quick reply. I truly appreciate the great help.
![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|