The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
IBM Informix Load and Insert with multiple files rauphelhunter Shell Programming and Scripting 0 04-09-2008 08:52 AM
comparing the null values in the unix bbc17484 Shell Programming and Scripting 11 02-12-2008 06:36 AM
handling null values in files ammu Shell Programming and Scripting 1 11-06-2007 01:43 PM
Find files which contain a null character Bab00shka UNIX for Dummies Questions & Answers 5 12-16-2005 07:41 AM
mv files to /dev/null primal UNIX for Dummies Questions & Answers 16 11-02-2001 05:09 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-12-2008
Registered User
 

Join Date: Nov 2007
Posts: 37
insert null in unix files

Hi everybody,

How to add null values in unix file?

This is what was asked to me in an interview.
Reply With Quote
Forum Sponsor
  #2  
Old 02-12-2008
Registered User
 

Join Date: Oct 2007
Posts: 9
maybe:

cat /dev/zero > test.txt

or

cat /dev/null > test.txt

??


Quote:
Originally Posted by sachin.gangadha View Post
Hi everybody,

How to add null values in unix file?

This is what was asked to me in an interview.
Reply With Quote
  #3  
Old 02-12-2008
otheus's Avatar
Moderator ala Mode
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 605
Appending nul characters in UNIX

Quote:
Originally Posted by sachin.gangadha View Post
Hi everybody,

How to add null values in unix file?

This is what was asked to me in an interview.
The previous poster should have said (for SH shells)

Code:
dd if=/dev/zero bs=1 count=<count> >> outfile.txt
Because you want to append some zero values. Cat'ing from /dev/null will give you nothing.

The other way, is if in you're vi/m, you can hit CTRL-V CTRL-@ to get a NUL character. You can also use perl to generate one.
Reply With Quote
  #4  
Old 02-12-2008
Registered User
 

Join Date: Nov 2007
Posts: 37
thanks for the reply.

I am not getting what you guys have explained probably bcoz i am jst a beginner.

Once again i am making my question clear. how to add null value to a file?

just wanna create a file with nulls. i dont know whether you can do this unix that is why i need experts like you guyz to answer.
Reply With Quote
  #5  
Old 02-12-2008
agn agn is offline
Registered User
 

Join Date: Feb 2008
Posts: 97
What do you mean by "adding null values to a file" ? What's the required output ?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0