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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Shell Programming and Scripting
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
3. UNIX for Dummies Questions & Answers
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
4. UNIX for Dummies Questions & Answers
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
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. UNIX for Beginners Questions & Answers
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
10. OS X (Apple)
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
LEARN ABOUT CENTOS
spi_execute_plan
SPI_EXECUTE_PLAN(3) PostgreSQL 9.2.7 Documentation SPI_EXECUTE_PLAN(3)
NAME
SPI_execute_plan - execute a statement prepared by SPI_prepare
SYNOPSIS
int SPI_execute_plan(SPIPlanPtr plan, Datum * values, const char * nulls,
bool read_only, long count)
DESCRIPTION
SPI_execute_plan executes a statement prepared by SPI_prepare or one of its siblings. read_only and count have the same interpretation as
in SPI_execute.
ARGUMENTS
SPIPlanPtr plan
prepared statement (returned by SPI_prepare)
Datum * values
An array of actual parameter values. Must have same length as the statement's number of arguments.
const char * nulls
An array describing which parameters are null. Must have same length as the statement's number of arguments. n indicates a null value
(entry in values will be ignored); a space indicates a nonnull value (entry in values is valid).
If nulls is NULL then SPI_execute_plan assumes that no parameters are null.
bool read_only
true for read-only execution
long count
maximum number of rows to return, or 0 for no limit
RETURN VALUE
The return value is the same as for SPI_execute, with the following additional possible error (negative) results:
SPI_ERROR_ARGUMENT
if plan is NULL or invalid, or count is less than 0
SPI_ERROR_PARAM
if values is NULL and plan was prepared with some parameters
SPI_processed and SPI_tuptable are set as in SPI_execute if successful.
PostgreSQL 9.2.7 2014-02-17 SPI_EXECUTE_PLAN(3)