Sponsored Content
Top Forums UNIX for Dummies Questions & Answers GREP a string with NULL Character Post 7079 by Perderabo on Tuesday 18th of September 2001 01:30:42 PM
Old 09-18-2001
I tried everything but I couldn't get this to work. I'm pretty sure that the problem in the NULL character. To a c program, a string is terminated by a null and grep seems to be behaving that way. Maybe

grep 0001 | grep N

will help you a little.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sending a null character to a terminal

I'm testing out some ESMTP AUTH stuff, and it requires that the username and password be on the same line separated by a null character. Does anyone know how to echo the ASCII null character? Thanks, Alex (3 Replies)
Discussion started by: vertigo23
3 Replies

2. UNIX for Dummies Questions & Answers

Find files which contain a null character

Hi, I would like to use grep to find files which contain NULL characters. I'm not sure how to represent the null character in the grep statement. Could anyone help please? Thanks! Helen :confused: (5 Replies)
Discussion started by: Bab00shka
5 Replies

3. 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

4. UNIX for Dummies Questions & Answers

Using /dev/null with grep and find

Hi, I am trying to display the filename in which a string was found after using find and grep. For this after some googling I found that this works: find -name "*.java" -exec grep "searchStr" {} /dev/null \; I wanted to know the difference between the above and the following: find -name... (0 Replies)
Discussion started by: gaurav_s
0 Replies

5. Programming

Question about NULL Character & fgets()

Assume client send the message " Hello ", i get output such as Sent mesg: hello Bytes Sent to Client: 6 bytes_received = recv(clientSockD, data, MAX_DATA, 0); if(bytes_received) { send(clientSockD, data, bytes_received, 0); data = '\0';... (2 Replies)
Discussion started by: f.ben.isaac
2 Replies

6. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 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. Shell Programming and Scripting

If grep value is null then assign 0 to variable

DELETE=`cat $logfile1 | egrep -i "Delete" | sed 's/ */ /g' | cut -d" " -f2` INSERT=`cat $logfile1 | egrep -i "Insert" | sed 's/ */ /g' | cut -d" " -f2` UPDATE=`cat $logfile1 | egrep -i "Update" | sed 's/ */ /g' | cut -d" " -f2` I need soming like below: if value is null... (8 Replies)
Discussion started by: Veera_V
8 Replies

9. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
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
GZGREP(1)						      General Commands Manual							 GZGREP(1)

NAME
gzgrep, gzegrep, gzfgrep - search possibly compressed files for a regular expression SYNOPSIS
gzgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
gzgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci- fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If gzgrep is invoked as gzegrep or gzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, gzgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep gzgrep string files for csh: (setenv GREP fgrep; gzgrep string files) AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), egrep(1), fgrep(1), gzdiff(1), gzmore(1), gznew(1), gzforce(1), gzip(1), gzexe(1) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgzip | +--------------------+-----------------+ |Interface Stability | External | +--------------------+-----------------+ NOTES
Source for gzip is available in the SUNWgzipS package. GZGREP(1)
All times are GMT -4. The time now is 10:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy