replace nulls with whitespaces in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting replace nulls with whitespaces in a file
Prev   Next
# 1  
Old 07-14-2009
replace nulls with whitespaces in a file

Hi,

i have a file which contains data in fixed length. each row contains data of 10 characters fixed length. The data in the file appears like 4567782882

some times i may recieve dat less than fixed length of 10. in such a case i find nulls appended at the trailing spaces when i do a hexdump. i should replace this nulls with whitespaces. how could this be done?

the possiblities where i may recieve nulls in the data is:
123 678910
12345
1
etc..

in all th above cases the nulls should be replaced by white spaces
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Create a bash array from a flat file of whitespaces only.

Hi guys and gals... MacBook Pro. OSX 10.13.2, default bash terminal. I have a flat file 1920 bytes in size of whitespaces only. I need to put every single whitespace character into a bash array cell. Below are two methods that work, but both are seriously ugly. The first one requires that I... (7 Replies)
Discussion started by: wisecracker
7 Replies

2. UNIX for Beginners Questions & Answers

Remove or truncate trailing nulls from file

I want to remove from a file the trailing null characters (0x00) and stop doing so when a different byte is found (which should not be deleted), and either put the result to the same file or a different one. Any ideas? (9 Replies)
Discussion started by: Tribe
9 Replies

3. Shell Programming and Scripting

Replace nulls with a value in a file

Hi, I've a PIPE delimited file with about 5 fields. Sometimes the records in the 4th field is null, so I want to replace it based on values we get it on 2nd field in the same file. Following is an example. ABCD|X-TYPE 3.0|2010|X-TYPE|20000 CDEF|C-TYPE 2.5|2011|C-TYPE|10000 XYZ|LX... (4 Replies)
Discussion started by: rudoraj
4 Replies

4. Shell Programming and Scripting

Separate letters and replace whitespaces

Input file: aaaa bbb dd. qqq wwww e. Output file: a a a a <s> b b b <s> d d . q q q <s> w w w w <s> e . Can I use sed to do so in one step? (5 Replies)
Discussion started by: Viernes
5 Replies

5. Shell Programming and Scripting

Replace trailing whitespaces with pipe symbol using perl

I want to replace the whitespace with Pipe symbol to do a multiple pattern matching for the whole text "mysqld failed start" and same as for other text messages Below are the messages stored in a file seperate by whitespace mysqld failed start nfsd mount failed rpcbind failed to start for... (6 Replies)
Discussion started by: kar_333
6 Replies

6. Shell Programming and Scripting

Test File for Existence with Whitespaces in Path

Hi Everyone! I'm quite new to shell scripting so this might be trivial, though 3 days of struggle and search didn't help to solve the problem: I want to look for files called '*HUN*' in a huge amount of directories most of their names contain whitespaces and print the path of the directory if... (8 Replies)
Discussion started by: sumi76
8 Replies

7. UNIX for Dummies Questions & Answers

trimming whitespaces in a file

Hello, Im trying write a bash sript to search a file and identify any file names that contain a space at the end of them. I was trying to use the grep command but I can find how I would identify the character I'm looking for. Any help would be grately appreciated. (2 Replies)
Discussion started by: gintreach
2 Replies

8. UNIX for Dummies Questions & Answers

Remove whitespaces between comma separated fields from file

Hello all, I am a unix dummy. I am trying to remove spaces between fields. I have the file in the following format 12332432, 2345 , asdfsdf ,100216 , 9999999 12332431, 2341 , asdfsd2 ,100213 , 9999999 &... (2 Replies)
Discussion started by: nitinbjoshi
2 Replies

9. Shell Programming and Scripting

How to check Null values in a file column by column if columns are Not NULLs

Hi All, I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies

10. UNIX for Dummies Questions & Answers

GREPing for Nulls

I just had a filesystem / file corruption issue on my HSP's server due to disk capacity limits and fileswapping. I discovered that certain files got corrupted when fileswapping was not successful and they ended up with a string of control characters, or what I believe to be nulls, in them. Does... (4 Replies)
Discussion started by: Dr. DOT
4 Replies
Login or Register to Ask a Question
EVP_OpenInit(3) 						      OpenSSL							   EVP_OpenInit(3)

NAME
EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption SYNOPSIS
#include <openssl/evp.h> int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, int ekl,unsigned char *iv,EVP_PKEY *priv); int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl); int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); DESCRIPTION
The EVP envelope routines are a high level interface to envelope decryption. They decrypt a public key encrypted symmetric key and then decrypt data using it. EVP_OpenInit() initializes a cipher context ctx for decryption with cipher type. It decrypts the encrypted symmetric key of length ekl bytes passed in the ek parameter using the private key priv. The IV is supplied in the iv parameter. EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as documented on the EVP_EncryptInit(3) manual page. NOTES
It is possible to call EVP_OpenInit() twice in the same way as EVP_DecryptInit(). The first call should have priv set to NULL and (after setting any cipher parameters) it should be called again with type set to NULL. If the cipher passed in the type parameter is a variable length cipher then the key length will be set to the value of the recovered key length. If the cipher is a fixed length cipher then the recovered key length must match the fixed cipher length. RETURN VALUES
EVP_OpenInit() returns 0 on error or a non zero integer (actually the recovered secret key size) if successful. EVP_OpenUpdate() returns 1 for success or 0 for failure. EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success. SEE ALSO
evp(3), rand(3), EVP_EncryptInit(3), EVP_SealInit(3) HISTORY
1.0.1e 2013-02-11 EVP_OpenInit(3)