How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job?
Thanks,
Hillxy (5 Replies)
Hi all,
Suppose I have a file with the contents below, and I only want to print words %S_ then | sort -u.
------------------------------
The %S_MSG that starts with '%.*s' is too long. Maximum length is %d.
The %S_MSG name '%.*s' contains more than the maximum number of prefixes. The... (5 Replies)
Hi everyone
I have file1 contains:
'7832'
' 8765
6543
I want a sed command that will format as:
'7832' , '8765' , '6543'
I tried
sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2
sed -e :a -e '$!N; s/\n/ /; ta' file2
which gives: 7832 8765 6543
I need some help to continue with... (5 Replies)
Hi,
I require to replace 2 items:
1. replace start of all lines in a file with ' except the first line
2. replace end of all lines in a file with '||chr( except last line
I am able to do the entire file using
sed -e s/^/\'/g -e s/$/\'\|\|chr\(/g "$file" > newfile.txt
but am not yet able... (0 Replies)
Hi,
I require to replace 2 items:
1. replace start of all lines in a file with ' except the first line
2. replace end of all lines in a file with '||chr( except last line
I am able to do the entire file using
sed -e s/^/\'/g -e s/$/\'\|\|chr\(/g "$file" > newfile.txt
but am not yet... (3 Replies)
Hi,
I'm trying to replace a range of characters by their position in each line by spaces.
I need to replace characters 95 to 145 by spaces in each line.
i tried below but it doesn't work
sed -r "s/^(.{94})(.{51})/\ /" inputfile.txt > outputfile.txt
can someone please help me... (3 Replies)
I have several files in a directory that look like this:
jacket-n r
potential-n -
outcome-n f
reputation-n b
I want to replace the characters in the second column with certain numbers. For instance, I want the letters 'f', 'r' and 'b' in the second column to replaced with 0 and I want the... (1 Reply)
Hi,
I hope you can help me out please?
I need to replace from character 8-16 with AAAAAAAA and the rest should stay the same after character 16
gtwrhtrd11111111rjytwyejtyjejetjyetgeaEHT
wrehrhw22222222hytekutkyukrylryilruilrGEQTH
hrwjyety33333333gtrhwrjrgkreglqeriugn;RUGNEURGU
... (4 Replies)
Hello,
I have some data that looks like the following,
> <SALTDATA> (OVS0199262)
HCl
> <IDNUMBER> (OVS0199262)
OVS0199262
> <SUPPLIER> (OVS0199262)
TimTec
> <EMAIL> (OVS0199262)
info@timtec.net
> <WEBSITE> (OVS0199262)
http://www.timtec.net
I need to remove the data in... (3 Replies)
Hi,
Im using sed on an AIX machine. I am trying to change the 137-139 characters if they are a ' 36'/'000' to a '036'. The positions that need to be changed are fixed.
the source data that I have is$cat v.txt
4000422985400050462239065593606500000007422985707771046154054910075641MC0318AMWAY... (9 Replies)
Discussion started by: dsid
9 Replies
LEARN ABOUT DEBIAN
ppmquant
ppmquant(1) General Commands Manual ppmquant(1)NAME
ppmquant - quantize the colors in a portable pixmap down to a specified number
SYNOPSIS
ppmquant [-floyd|-fs] ncolors [ppmfile]
ppmquant [-floyd|-fs] [-nofloyd|-nofs] -mapfile mapfile [ppmfile]
All options can be abbreviated to their shortest unique prefix. You may use two hyphens instead of one to designate an option. You may
use either white space or equals signs between an option name and its value.
DESCRIPTION
pnmquant is a newer, more general program that is backward compatible with ppmquant. ppmquant may be faster, though.
Reads a PPM image as input. Chooses ncolors colors to best represent the image, maps the existing colors to the new ones, and writes a PPM
image as output.
The quantization method is Heckbert's "median cut".
Alternately, you can skip the color-choosing step by specifying your own set of colors with the -mapfile option. The mapfile is just a ppm
file; it can be any shape, all that matters is the colors in it. For instance, to quantize down to the 8-color IBM TTL color set, you
might use:
P3
8 1
255
0 0 0
255 0 0
0 255 0
0 0 255
255 255 0
255 0 255
0 255 255
255 255 255
If you want to quantize one image to use the colors in another one, just use the second one as the mapfile. You don't have to reduce it
down to only one pixel of each color, just use it as is.
If you use a mapfile, the output image has the same maxval as the mapfile. Otherwise, the output maxval is the same as the input maxval,
or less in some cases where the quantization process reduces the necessary resolution.
The -floyd/-fs option enables a Floyd-Steinberg error diffusion step. Floyd-Steinberg gives vastly better results on images where the
unmodified quantization has banding or other artifacts, especially when going to a small number of colors such as the above IBM set. How-
ever, it does take substantially more CPU time, so the default is off.
-nofloyd/-nofs means not to use the Floyd-Steinberg error diffusion. This is the default.
REFERENCES
"Color Image Quantization for Frame Buffer Display" by Paul Heckbert, SIGGRAPH '82 Proceedings, page 297.
SEE ALSO pnmquant(1), ppmquantall(1), pnmdepth(1), ppmdither(1), ppm(5)AUTHOR
Copyright (C) 1989, 1991 by Jef Poskanzer.
12 January 1991 ppmquant(1)