The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
create data file from report file cvvsnm UNIX for Dummies Questions & Answers 3 02-01-2008 12:25 PM
Read words from file and create new file using K-shell. bsrajirs Shell Programming and Scripting 4 06-01-2007 12:15 PM
File Compare and Create New File with Diff guiguy UNIX for Advanced & Expert Users 7 02-28-2007 06:43 AM
Howto Attach File with Sendmail monkfan UNIX for Dummies Questions & Answers 2 05-18-2006 08:43 AM
howto change parameter in vi to take tmp file ajaya UNIX for Dummies Questions & Answers 4 03-29-2006 11:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2007
amit4g's Avatar
amit4g amit4g is offline
Registered User
  
 

Join Date: Apr 2006
Location: Bangalore,India
Posts: 29
Howto create a file

Hi folks,

How do we create a file using shell script?
i mean to say that do we use
is it a good approch to do
echo "abc" >file
echo "xxxx" >>file

or is there any better method?

Thanks,
Amit
  #2 (permalink)  
Old 02-07-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
try this

Code:
cat > 111
After this type text and press ^d to save a file.
  #3 (permalink)  
Old 02-07-2007
Dhruva's Avatar
Dhruva Dhruva is offline
Registered User
  
 

Join Date: Mar 2006
Location: India
Posts: 255
Both approaches are correct what really matter is your choice.
you can create file using ">" operator and later you can append on same file with ">>" operator.
  #4 (permalink)  
Old 02-07-2007
lowbyte lowbyte is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 73
why not using touch?
ex. touch filename

cu
lowbyte
  #5 (permalink)  
Old 02-07-2007
amit4g's Avatar
amit4g amit4g is offline
Registered User
  
 

Join Date: Apr 2006
Location: Bangalore,India
Posts: 29
Thanks to all of you,this almost satisfies my querry.
  #6 (permalink)  
Old 02-07-2007
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
If you need a file with a certain size, use dd command or check the man pages depending on your needs.
The last thing I needed was to create 150GB file, I did it like that :
Code:
dd if=/dev/zero of=150g bs=1073741824 count=150
Sponsored Links
Closed Thread

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 05:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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