Sponsored Content
Top Forums Shell Programming and Scripting Remove first NULL Character in Flat File Post 303004695 by Don Cragun on Friday 6th of October 2017 03:42:18 PM
Old 10-06-2017
By definition, UNIX text utility tools work on text files, and text fiies do not contain NUL bytes. Some text utilities on some operating systems can handle NUL bytes even though doing so is not required by the standards. But, of course, you haven't bothered to tell us what operating system you're using.

Are there always three NUL bytes that you want to remove? Or, does the number of NUL bytes vary? If the number varies, you can use something like od to determine the number of leading NUL bytes and then you can use dd to skip over those bytes and copy the rest of the data in the file to another file.
These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting a flat file based on multiple colums(using character position)

Hi, I have an urgent task here. I am required to sort a flat file based on multiple columns which are based on the character position in that line. I am restricted to use the character position instead of the space and sort +1 +2 etc to do the sorting. I understand that there is a previous... (8 Replies)
Discussion started by: cucubird
8 Replies

2. Shell Programming and Scripting

How to remove page breaks from a flat file???

Hi All, I get a flat file with its last field data splitting onto a new line.I got this program from Vgersh which when run would cancatenate the split data back to the end of the previous records.But this program fails when it encounters a page break between the split data and the previous... (5 Replies)
Discussion started by: kumarsaravana_s
5 Replies

3. UNIX for Dummies Questions & Answers

How to remove null characters from file?

I'm trying to remove the null characters from a file and copy it to std output. I'm using emacs and I create the following one line bash file (followed by the error messages): sed -e 's/^@//' <ConfigItemReplicator.install.log /usr/bin/bash: -c: line 0: unexpected EOF while looking for... (1 Reply)
Discussion started by: siegfried
1 Replies

4. UNIX for Dummies Questions & Answers

how to remove the first line from a flat file ?

Hi, I want to remove the first line from a flat file using unix command as simple as possible. Can anybody give me a hand ? Thanks in advance. xli (21 Replies)
Discussion started by: xli
21 Replies

5. Shell Programming and Scripting

Remove somewhat Duplicate records from a flat file

I have a flat file that contains records similar to the following two lines; 1984/11/08 7 700000 123456789 2 1984/11/08 1941/05/19 7 700000 123456789 2 The 123456789 2 represents an account number, this is how I identify the duplicate record. The ### signs represent... (4 Replies)
Discussion started by: jolney
4 Replies

6. Shell Programming and Scripting

Read from Multiple character delimited flat file

Hello Guys I have a multiple character delimited flat file "|~|". when I tried to read the data the "|" character also coming Example I/P file 9882590|~|20111207|~|K03501000063005574033961|~|K|~| Command to get the second column I used awk -F"|~|" ' {print $2}' ... (2 Replies)
Discussion started by: Pratik4891
2 Replies

7. UNIX for Advanced & Expert Users

Insertion of Null Character while writing into file

I have a huge file with record length around 5000 characters. There is an ETL tool datastage which is writing this data to the file(AIX server). At position 4095 i have seen NULL Character(^@). when i am using this command "head -1 file_nm | sed 's/\000//g'" --- the output is displaying... (3 Replies)
Discussion started by: issaq84mohd
3 Replies

8. UNIX for Dummies Questions & Answers

How to remove numeric characters in the flat file

HI, can any one help me please .. i have flat file like qwer123rt ass3242ccf jjk654 kjh838ppp nhdg453ok hdkk34 i want remove numeric characters in the flat file i want output like this qwerrt assccf jjk kjhppp nhdgok hdkk help me... (4 Replies)
Discussion started by: rafimd1985
4 Replies

9. UNIX for Advanced & Expert Users

Remove duplicates in flat file

Hi all, I have a issues while loading a flat file to the DB. It is taking much time. When analyzed i found out that there are duplicates entry in the flat file. There are 2 type of Duplicate entry. 1) is entire row is duplicate. ( i can use sort | uniq) to remove the duplicated entry. 2) the... (4 Replies)
Discussion started by: samjoshuab
4 Replies

10. UNIX for Dummies Questions & Answers

To flat file, append null or space if its length is less than 10

Hi, We receive flat files with fixed width data Now our goal is append from right null or space to each record if the lenght of the record is less than for example 10. for example 123 45 6 0 123 45 123 45 6 123 and output should be 123 45 6 0 123 45**** 123 45 6**... (7 Replies)
Discussion started by: shharrath
7 Replies
COPY(9)                                                    BSD Kernel Developer's Manual                                                   COPY(9)

NAME
copy, copyin, copyout, copystr, copyinstr -- kernel copy functions SYNOPSIS
#include <sys/types.h> #include <sys/systm.h> int copyin(const void *uaddr, void *kaddr, size_t len); int copyout(const void *kaddr, void *uaddr, size_t len); int copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done); int copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done); DESCRIPTION
The copy functions are designed to copy contiguous data from one address to another. All but copystr() copy data from user-space to kernel- space or vice-versa. The copy routines provide the following functionality: copyin() Copies len bytes of data from the user-space address uaddr to the kernel-space address kaddr. copyout() Copies len bytes of data from the kernel-space address kaddr to the user-space address uaddr. copystr() Copies a NUL-terminated string, at most len bytes long, from kernel-space address kfaddr to kernel-space address kdaddr. The number of bytes actually copied, including the terminating NUL, is returned in *done (if done is non-NULL). copyinstr() Copies a NUL-terminated string, at most len bytes long, from user-space address uaddr to kernel-space address kaddr. The num- ber of bytes actually copied, including the terminating NUL, is returned in *done (if done is non-NULL). RETURN VALUES
The copy functions return 0 on success or EFAULT if a bad address is encountered. In addition, the copystr(), and copyinstr() functions return ENAMETOOLONG if the string is longer than len bytes. SEE ALSO
fetch(9), store(9) BSD January 7, 1996 BSD
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy