The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
converting hex to dec aismann Shell Programming and Scripting 4 02-26-2008 05:51 AM
sed converting / to \/ sakthi.abdullah UNIX for Advanced & Expert Users 8 12-14-2006 03:56 AM
Converting seeyou SCO 3 01-19-2006 02:22 PM
converting .txt laila63 UNIX for Dummies Questions & Answers 4 06-30-2004 04:56 PM
converting kb to mb csaunders UNIX for Dummies Questions & Answers 1 02-26-2004 04:14 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-28-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Converting \0 to a \n

Hi - I have seen some similar posts but I am a bit stumped here

below is the first line of a 'od -c filename' command. I want to change the \0 to \n

0000000 l s \0 c d - \0 c d . . \0 l s

I have tried a sed construct in a script.........

sed 's|\\0|\\n|g' filename - with no success.

If I type this at the command line the cursor shoots off to the left margin of the screen as soon as I type the second '|'

Any help most appreciated - I am sure this should not be this difficult!!
  #2 (permalink)  
Old 09-28-2007
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Check your man page for tr.

Mine says -

SunOS 5.10 Last change: 13 Aug 2003 7

User Commands tr(1)

Unlike some previous versions, /usr/xpg4/bin/tr correctly
processes NUL characters in its input stream. NUL characters
can be stripped by using tr -d '\000'.

so try tr -d < (infilename) > (outfilename)
  #3 (permalink)  
Old 09-28-2007
ajcannon ajcannon is offline
Registered User
  
 

Join Date: Aug 2007
Location: Binfield, Berkshire. UK
Posts: 91
Red Herring

Hi

please disregard the comment about the cursor heading off to the left margin - my terminal emulator is playing up.

cheers
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0