- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Stickey NUL issue ... sed/grep/awk ... perl
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
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
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
тАО04-12-2005 12:40 AM
тАО04-12-2005 12:40 AM
How do I (1) detect and (2) replace a mid-line null, such as:
This is a li^@ne in a text file ...
Where the ^@ is a NUL character?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 01:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 01:03 AM
тАО04-12-2005 01:03 AM
Re: Stickey NUL issue ... sed/grep/awk ... perl
0000000 T h i s i s \0 t h e f i l e
0000020 .
0000021
cat /tmp/1.txt | vis
This is\000the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 01:08 AM
тАО04-12-2005 01:08 AM
Re: Stickey NUL issue ... sed/grep/awk ... perl
{idx1=index($0,"\0");
if (idx1==0) {print $0;next}
newstring=substr($0,1,index-1)substr($0,index+1);
}
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 01:08 AM
тАО04-12-2005 01:08 AM
Re: Stickey NUL issue ... sed/grep/awk ... perl
xxx is ascii char you want to replace 000 with. man ascii for details.
Anil
- Tags:
- tr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 01:09 AM
тАО04-12-2005 01:09 AM
Re: Stickey NUL issue ... sed/grep/awk ... perl
In awk, I think you could do:
{idx1=index($0,"\0");
if (idx1==0) {print $0;next}
newstring=substr($0,1,index-1)substr($0,index+1); print newstring;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2005 02:46 AM
тАО04-12-2005 02:46 AM
Re: Stickey NUL issue ... sed/grep/awk ... perl
# perl -e 'printf "Thisis%cthefile\n",0' > x
# cat x
Thisisthefile
# od -c x
0000000 T h i s i s \0 t h e f i l e \n
#
# perl -pe 's/\0//' x | od -c
0000000 T h i s i s t h e f i l e \n
#
# cat x | tr -d "\000" | od -c
0000000 T h i s i s t h e f i l e \n
#
# awk '{gsub(/\000/,""); print}' x | od -c
0000000 T h i s i s t h e f i l e \n
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 06:40 AM
тАО05-22-2006 06:40 AM