Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to remove null characters from file? Post 302180979 by siegfried on Tuesday 1st of April 2008 04:36:57 PM
Old 04-01-2008
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):
Code:
sed -e 's/^@//' <ConfigItemReplicator.install.log
/usr/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/usr/bin/bash: -c: line 1: syntax error: unexpected end of file

Of course, in emacs the "^@" is really a single null character.

Well I think bash is seeing the null character and terminating the string.

So this is not working! how do I remove my nulls?
Thanks,
Siegfried
Siegfried
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Null Characters

How do I get rid of null characters/strings in a unix text file. I need to use this in a script. When I use dev/null it puts null characters in my file and makes it larger. Please help (5 Replies)
Discussion started by: alnita
5 Replies

2. Shell Programming and Scripting

Remove characters from file name

Here is my code. for file in *1.3.html ; do mv "$file" `echo $file | tr '.1.3' ''` ; done For some reason I am getting an error. mv: file.idlesince.1.3.html and file.idlesince.1.3.html are identical Could this be done a different way? (5 Replies)
Discussion started by: mrlayance
5 Replies

3. Shell Programming and Scripting

Trying to remove '^M' characters from a file.

Hi guys, Hope you are all well. This is a line of data from a csv file. I have used vi and set the 'set list' option to display the trailing $ character. "01","Grocery","01006","eat Fish & Spreads"$ I have tried the following commands, but neither of them appear to be working? 1) tr... (13 Replies)
Discussion started by: Krispy
13 Replies

4. Shell Programming and Scripting

How to remove ^M characters from a zip file?

Hi All, As all of us know that while moving a file from Windows to Unix some unwanted ^M characters appear in the file. For my case I have release package in zip format which looks like Module_Name_Tag.zip. It contains some directory structure...like Module_Name_Tag.zip | |--trunk/... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

5. Shell Programming and Scripting

Remove the characters from the file

Hi, I have one file in the following format. exa_resu_adj.4ge v.47645 PERSONAL INFORMAIONS PVT LTD 31 Dec 2009 04:36 Page 1 SALARY REPORT Account Account Name CCode Bill No Balance T Amt ----------- ------------ ------- ---------- ------------- ------------- 17490001 Mr Ram PM 10... (6 Replies)
Discussion started by: Kattoor
6 Replies

6. UNIX Desktop Questions & Answers

Remove new line characters from a file

I tried using below command tr -cd "" < InputFile.xml > output.txt ============= This removes all the tabs/newline/extra spaces from a file it successfully removed all the extra spaces,tabs and new line characters but then the complete file become one record. I want to retain one new line... (1 Reply)
Discussion started by: saini
1 Replies

7. Shell Programming and Scripting

Remove characters from fixed length file

Hello I've question on the requirement I am working on. We are getting a fixed length file with "33" characters long. We are processing that file loading into DB. Now some times we are getting a file with "35" characters long. In this case I have to remove two characters (in 22,23... (14 Replies)
Discussion started by: manasvi24
14 Replies

8. Shell Programming and Scripting

Remove characters from the file

i know , the below question has been repeated. can you guys guide me . I have the below input 999999 xxxxxxxxxxxxxx 123.45 2013-05-02 08:14 1 1 1 xxxx 999999 xxxxxxxxxxxxxx 123.45 2013-06-02 02:14 1 4 1 dddd i need to remove from the column 54 to 70 , as like the below output.... (9 Replies)
Discussion started by: expert
9 Replies

9. Shell Programming and Scripting

Remove non printing characters from file

How do I remove the printer escape sequence, the first 5 characters, that occurs on every 33rd line in a file, see hex dump of line 1. 0000 1e 00 00 00 00 0a 0a 0a 20 0a 20 20 20 20 20 20 .... 0010 20 20 20 20 20 20 20 20 20 20 0a 42 49 4c 4c 20 Thanks, (2 Replies)
Discussion started by: jgt
2 Replies

10. Shell Programming and Scripting

Remove first NULL Character in Flat File

We have a flat file with below data : ^@^@^@^@00000305^@^@^@^@^@^@430^@430^@^@^@^@^@^@^@^@^@09079989530As we can see ^@ is Null character in this file I want to remove only the first few null characters before string 00000305 How can we do that, any idea. I want a new file without first few... (5 Replies)
Discussion started by: simpltyansh
5 Replies
wmemory(3C)															       wmemory(3C)

NAME
wmemchr(), wmemcmp(), wmemcpy(), wmemmove(), wmemset() - memory operations based on wide-character SYNOPSIS
DESCRIPTION
These functions operate as efficiently as possible on memory areas (arrays of wide-characters bounded by a count, not terminated by a null wide-character). They do not check for the overflow of any receiving memory area. These functions are not affected by locale and all values are treated identically. The null wide-character and values not corresponding to valid characters are not treated specially. The function locates the first occurrence of wc in the initial n wide-characters of the object pointed to by ws. The function returns a pointer to the located wide-character or a null pointer if the wide-character does not occur in the object. The function compares the first n wide-characters of the object pointed to by ws1 to the first n wide-characters of the object pointed to by ws2. The function returns an integer greater than, equal to, or less than zero, accordingly as the object pointed to by ws1 is greater than, equal to, or less than the object pointed to by ws2. The function copies n wide-characters from the object pointed to by ws2 to the object pointed to by ws1. The null wide-charac- ter and values not corresponding to valid characters are not treated specially. The function returns the value of ws1. The function copies n wide-characters from the object pointed to by ws2 to the object pointed to by ws1. Copying takes place as if the n wide-characters from the object pointed to by ws2 are first copied into a temporary array of n wide-characters that does not overlap the objects pointed to by ws1 or ws2, and then the n wide-characters from the temporary array are copied into the object pointed to by ws1. The function returns the value of ws1. The function copies the value of wc into each of the first n wide-characters of the object pointed to by ws. The function returns the value of ws. APPLICATION USAGE
The prototypes of these functions are available to applications if they are: a. conformant. b. Compiled with macro with a value >= 500. c. Compiled with macro with a value >= 200112. ERRORS
No errors are defined. AUTHOR
were developed by HP and Mitsubishi Electric Corp. SEE ALSO
thread_safety(5), glossary(9). wmemory(3C)
All times are GMT -4. The time now is 11:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy