The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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 02:54 AM
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 07: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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-26-2006
nxd25 nxd25 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 2
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

The input file is just a file with random text that equals the size of the largest file this script will create.

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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0