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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-06-2007
Registered User
 

Join Date: Jul 2006
Posts: 84
handling null values in files

Hi ,

I have a script where i will remove header and trailer record and ftp to another server.

I'm using the code:

latestfilename=`ls filename_* | tail -1`
echo "Latest filename = $latestfilename"
sed '1d;$d' $latestfilename > a.ftpedfile

I have an issue if input data is having null values.The data looks like this:

Input record has :00223715232238200 N NULL 1999031920000707 abc *

In place of NULL i have a null.

MY output is :

00223715232238200 N 1999031920000707 abc *

The record is shifted.

Please advice how to transfer null as it is.And also please let me know if i ftp the file with null values the values should not be dropped.

Thanks in advance!
Sponsored Links
  #2 (permalink)  
Old 11-06-2007
Registered User
 

Join Date: Oct 2007
Posts: 157
The "sed" command should not alter lines that were not selected.

However, FTP may "help" you by converting text files. If the files are transferred as binary instead of ASCII, then they shall remain unmodified.
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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
identifying null values in a file dsravan Shell Programming and Scripting 3 02-12-2008 05:28 PM
Null Character Handling npk2210 Shell Programming and Scripting 3 09-29-2007 05:51 AM
Handling null input... DrRo183 Shell Programming and Scripting 2 04-11-2006 02:32 AM
Null handling in scripts mohanprabu Shell Programming and Scripting 3 01-20-2005 04:50 PM
Null values after emptying a log file kasie4life Shell Programming and Scripting 2 10-07-2004 10:36 AM



All times are GMT -4. The time now is 01:50 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-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0