Shell command to convert low values to spaces


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell command to convert low values to spaces
# 1  
Old 11-07-2011
Shell command to convert low values to spaces

I neead a script which converts low values to the spaces, When I used
sed -e 's/\x00/\x20/g' inputfile command it is removing the low values but not replacing it with spaces. Please help me. Its Uregent. Thanks

Sam
# 2  
Old 11-07-2011
Try
Code:
sed "s/[[:cntrl:]]/ /g" inputfile

# 3  
Old 11-07-2011
Its not working , it is generating a file of zero byets
# 4  
Old 11-07-2011
Works for me.
Code:
# od -x 1.txt
0000000 6c62 6861 0020 0201 2003 6c62 6861 0420
0000020 0605 6220 616c 2068 0c07 200d 6c62 6861
0000040 0f20
0000042
# sed "s/[[:cntrl:]]/ /g" 1.txt | od -x
0000000 6c62 6861 2020 2020 2020 6c62 6861 2020
0000020 2020 6220 616c 2068 2020 2020 6c62 6861
0000040 2020
0000042
# sed --version
GNU sed version 4.1.5

What version of sed are you using?
# 5  
Old 11-07-2011
See if this works:
Code:
tr '\000' '\040' < File

# 6  
Old 11-07-2011
how about:
Code:
tr '\0-\020' ' ' <myFile

# 7  
Old 11-07-2011
I didn't understand... what do you mean by low values?... you mean null values?

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to convert any shell command output to JSON format?

Hi All, I am new to shell scripting, Need your help in creating a shell script which converts any unix command output to JSON format output. example: sample df -h command ouput : Filesystem size used avail capacity Mounted /dev/dsk/c1t0d0s0 8.1G 4.0G 4.0G 50% /... (13 Replies)
Discussion started by: balu1234
13 Replies

2. Shell Programming and Scripting

Shell command to Strip white spaces at specific location

Hello, I have a Comma separated input file with one of the sample records as below: -9223372036854477528,"834","834003325515BXNI00101012013C","5","PLAN_VALUE","PPO, General Cable","C",20130101,99991231,"A","2012-12-25-13.58.14.434000","ZPL2 ","2012-12-25-13.58.14.434000","ZPL2 ... (4 Replies)
Discussion started by: Praveenkulkarni
4 Replies

3. Shell Programming and Scripting

Convert for command from DOS to SHELL

Well, this command has served me quite well under DOS for %%X in (*.txt) do COMMAND however in linux it just outputs: "./install.sh line 1: '%%x': not a valid identifier. Ideas ? Thanks in advance (2 Replies)
Discussion started by: pasc
2 Replies

4. Shell Programming and Scripting

Convert Column Values to a Range of Values

I have a list of columns with values that I need to transform into a row containing the range of each column. For example: "Column A" 1 2 3 4 10 12 14 15 16 17 18 "Column B" 1 4 5 6 (4 Replies)
Discussion started by: newbio
4 Replies

5. AIX

High Runqueue (R) LOW CPU LOW I/O Low Network Low memory usage

Hello All I have a system running AIX 61 shared uncapped partition (with 11 physical processors, 24 Virtual 72GB of Memory) . The output from NMON, vmstat show a high run queue (60+) for continous periods of time intervals, but NO paging, relatively low I/o (6000) , CPU % is 40, Low network.... (9 Replies)
Discussion started by: IL-Malti
9 Replies

6. Shell Programming and Scripting

convert rows (with spaces) to columns

Hey all, I have a list in the format ; variable length with spaces more variable information some more variable information and I would like to transform that 'column' into rows ; variable length with spaces more variable information some more variable information Any... (8 Replies)
Discussion started by: TAPE
8 Replies

7. HP-UX

Replace all 'low values" in a file

Hi, I've to replace all low values (hex '00') in a flat file (containing more than 1,000,000 records) with space (hex '20'). I try to use: awk '{gsub("\x00","\x20")}' file_name and I obtain the following response: awk: Line AP000010536900577986 cannot have more than 199 fields.... (2 Replies)
Discussion started by: sw.an
2 Replies

8. UNIX for Advanced & Expert Users

How to convert shell scrip to binaric command

here is a typical question for everyone ... How to convert a given shell script to binaric command along with its shell script switches. Any !dea (1 Reply)
Discussion started by: raghunsi
1 Replies

9. Shell Programming and Scripting

low & high values

on the file Ftp'd from the mainframe ,do we have any UNIX command to replace mainframe low and values to space or null. i tried using tr and it doesn't work ... Thanks (1 Reply)
Discussion started by: rlmadhav
1 Replies

10. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
Login or Register to Ask a Question