handling null values in files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting handling null values in files
# 1  
Old 11-06-2007
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!
# 2  
Old 11-06-2007
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check for null values in a columns. I have dozen of CSV files in a directory.

Hi Folks, I'm trying to write a simple file sanity check script. I have a directory with dozen CSV files containing id,edname,firstname,lastname,suffix,email. I like to write a awk script to check if first field contain a number and is not empty. and fields number 3,4 & 6 are not empty and... (3 Replies)
Discussion started by: dc34684
3 Replies

2. Shell Programming and Scripting

File values alwaya null

Hi All , below is my shell program. !/bin/sh set -x #---------------------------------------------------------------------------------------- # Program : weekly_remove_icd_file.sh # Author : # Date : 04/06/2013 # Purpose : Execute the script to... (3 Replies)
Discussion started by: krupasindhu18
3 Replies

3. Shell Programming and Scripting

How to use sort with null values?

Hello everyone I am doing a join command. Obviously, before I need two files sorted first. ( Both files have headers and have about 2 million lines each one ) The problem is, one of the files has null values in the key to sort (which is the first filed ). For example I have the original... (4 Replies)
Discussion started by: viktor1985
4 Replies

4. Shell Programming and Scripting

Handling null Integer/string variables

I kind of found out the hard way that I am not able to manipulate the null value, the long silence that happens when there is no value returned. I am looking for PIDs, and when there is no PID return, I wanted to handle this special scenario. Here is my script. #!/bin/bash LAN_VARIABLE=... (7 Replies)
Discussion started by: lan123
7 Replies

5. Shell Programming and Scripting

sorting null values

Hi I have a file with the values abc res set kls lmn ops i want to sort this file with the null values at the bottom of the file OUTPUT should look like this abc kls lmn ops (6 Replies)
Discussion started by: vickyhere
6 Replies

6. Shell Programming and Scripting

Null Handling in Until loop. . .loop won't stop

Hi Im running this script, which is supposed to find the max value build some tables and then stop running once all the tables are built. Thing is , it keeps assigning a null value to $h and then $g is null so it keep building tables i.e. testupdateNUL. How can I stop this? Here is what I have: ... (4 Replies)
Discussion started by: brandono66
4 Replies

7. UNIX for Advanced & Expert Users

How to Compare Null values??

Hi, Can someone help me comparing Null values. Scenario is as follows: I have a variable which "cache_prd" which can have either some integer or nothing(Null) if it is integer I have to again do some comparision but these comparisons give me this error:( "line 32: [: 95: unary operator... (3 Replies)
Discussion started by: Yagami
3 Replies

8. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: npk2210
3 Replies

9. Shell Programming and Scripting

Handling null input...

Ok, so when a user inputs nothing, simply pressing enter when prompted for a phone number, I get a "./addrbkfct.sh: test: argument expected" error message. I have the following function: addNumber(){ echo "Phone number: \c"; read number; echo $number; if ;... (2 Replies)
Discussion started by: DrRo183
2 Replies

10. Shell Programming and Scripting

Null handling in scripts

Hi, I face some problem with handling of nulls. I declare a variable - say i - and intialise to 0. Later I read it from console, wherein if I dont give any variable and press return key, I get this error: "0403-004 Specify a parameter with this command" Is there anyway to handle this error? ... (3 Replies)
Discussion started by: mohanprabu
3 Replies
Login or Register to Ask a Question