Converting \0 to a \n


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
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  
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  
Red Herring

Hi

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

cheers
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #998
Difficulty: Medium
Hooksafe is a hypervisor-based light system that safeguards a computer's kernel from rootkit attacks.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help in converting

I have Excel file with the below three columns, i need your expertise in converting this to .csv file delimiter "|" Excel - Serial Number Serial Name Serial Brand 111 test sample 123 test2 sample1 134 ... (9 Replies)
Discussion started by: kiran_hp
9 Replies

2. Solaris

Help converting my Script

So i have been asked to write a script for a friend who has a server running solaris 11. My problem is the correct syntax i can't seem to get it work with the follow code, i have read through the date man page and found no work around Below is the code for part of the rsync script. The code i... (2 Replies)
Discussion started by: paperghost
2 Replies

3. UNIX for Advanced & Expert Users

Need help converting ctlU (^U) to a \12...

I have a file that ends with a ctlU: > cat -v test.file blah,blah,blah,GEAEA*1*xx0000111xxx^UIEA*xxx0^U would like to replace the ctlU (^U) with a "\12"...due to printers or something. I believe I might be able to utilize the tr command, if I could only identify the correct... (4 Replies)
Discussion started by: mr_manny
4 Replies

4. SCO

library converting

Hi everybody Is there any sco unix command to convert .so library to .a (under sco unix openserver.5.0.6) tnx (2 Replies)
Discussion started by: javad1_maroofi
2 Replies

5. Shell Programming and Scripting

Converting Coins

Hi all, I have never written a script so I guess you could say I am very yellow.:) However, I could use some help.... I need to write a Korn Shell Script that converts coins. Meaning if I print or echo "Please enter amount:" and the user puts in 3.87, I need to know the least amount of coins... (11 Replies)
Discussion started by: tzeman
11 Replies

6. SCO

Converting

I use Sco_Sv 3.2v5.0.5 with parellel conection using dump terminals and i want to convert them to desktop pc. Anybody knows what hardware and other thing that would be involved? (3 Replies)
Discussion started by: seeyou
3 Replies

7. Programming

need help on some converting command

Hi all, i am trying to use C in unix platform to convert a double variable (floating point) to a string variable. i tried using sprintf, ecvt, fcvt,gcvt. but all gave me funny output or altered the content. does anyone know how to convert the data and keep the original content. for... (3 Replies)
Discussion started by: szeliat
3 Replies

8. Shell Programming and Scripting

Converting to Uppercase

I want to convert string into uppercase string. How can i do that ? Ex: Enter the user name: read name show=upper(name) echo $show --- This output should be the uppercase output. Thanks (3 Replies)
Discussion started by: dreams5617
3 Replies

9. UNIX for Dummies Questions & Answers

converting .txt

Hello, I transferred some .txt files from windows to Unix. When i used the editor in Unix to open up the file, all the <cr> show up. How to I get rid of all of them? (4 Replies)
Discussion started by: laila63
4 Replies

10. UNIX for Dummies Questions & Answers

converting kb to mb

When I create filesystems in AIX i often get confused(using smit) When you specify size in aix, it is asked like this SIZE of file system (in 512-byte blocks) I never seem to grasp this, what is the equation to get say 500mb? Or is there a program anyone knows of that does this, like a... (1 Reply)
Discussion started by: csaunders
1 Replies

Featured Tech Videos