- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep issue
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 06:37 AM
09-26-2002 06:37 AM
The file is too big to vi on our system.
We would like to print out all the lines which contain nulls. Unfortunately null (ASCII 0) is the string terminator, so awk, sed and grep take everything up the null as the string and everything afterwards as the next one.
i.e. grep '\0' doesn't work, the manual says that null strings print every character anyway.
Please test your ideas before posting them.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 06:45 AM
09-26-2002 06:45 AM
Re: grep issue
are you trying to identify the lines that have embedded null's in them or trying to remove them??
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 06:50 AM
09-26-2002 06:50 AM
Re: grep issue
See "man od"
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 06:51 AM
09-26-2002 06:51 AM
Re: grep issue
These nulls form part of a fixed length record, so removing them or replacing them with something is not going to help.
If only it were a simple case of replacement with tr '\0' ' ' < infile > outfile ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:03 AM
09-26-2002 07:03 AM
Re: grep issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:04 AM
09-26-2002 07:04 AM
Re: grep issue
Why not have them send you the file again without the nulls?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:11 AM
09-26-2002 07:11 AM
Re: grep issue
Actually I have just spotted the C function call gets() reads to a new line, whereas fgets stops at nulls. Maybe I could write a program, unless someone can come up with a neat bit of perl or python or something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:20 AM
09-26-2002 07:20 AM
Re: grep issue
Set $reclen to the length of your fixed length records.
open(INP,"
while(read(INP,$datum,$reclen)) {
$nrec++;
if($datum=~/\00/m) { print "nul at record# $nrec\n";}
}
Hope this helps...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:24 AM
09-26-2002 07:24 AM
Re: grep issue
I learned something new today.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 07:50 AM
09-26-2002 07:50 AM
Re: grep issue
perl -nle 'print if /\0/' < datafile
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2002 10:17 AM
09-27-2002 10:17 AM
Re: grep issue
Robin, that was a very elegant solution!
Regards!
...JRF...