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
handling null values in files ammu Shell Programming and Scripting 1 11-06-2007 04:43 PM
Handling null input... DrRo183 Shell Programming and Scripting 2 04-11-2006 02:32 AM
Find files which contain a null character Bab00shka UNIX for Dummies Questions & Answers 5 12-16-2005 10:41 AM
sending a null character to a terminal vertigo23 UNIX for Advanced & Expert Users 3 09-30-2005 10:58 PM
Null handling in scripts mohanprabu Shell Programming and Scripting 3 01-20-2005 04:50 PM

 
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 09-28-2007
npk2210 npk2210 is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 6
Null Character Handling

Hi All,

I have a problem with Null values while reading line by line from a text file. I wrote a shell script to read set of file names from a text file line by line, and zipping the each individual file and copying those zip files into some separate directory, and removing the original file from current directory. My shell script is as follows

#!/usr/bin/ksh
cat OCloader_gdlfiles/loaded_gdl_archive_file_list.txt | while read LINE
do
zip OCloader_archive/gdl_loaded/$LINE.zip OCloader_gdlfiles/$LINE
rm OCloader_gdlfiles/$LINE
done


Note:- Here OCloader_gdlfiles is a soft link to some other directory in unix box.

Now my problem was, Suppose while reading the lines from the text file, if any null input is assigned to the LINE variable then the rm command is as follows

rm OCloader_gdlfiles/NULL

then the corresponding soft link is removing from the unix box. To avoid this how should i change my code. I don't have any idea to do this. Your help will be appriciated.
 

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 09:36 AM.


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