08-31-2012
If you have bash you may be able to use mapfile.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX?
Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies
2. Programming
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
Discussion started by: kmehta
4 Replies
3. Shell Programming and Scripting
cat myname.txt
John Doe I
John Doe II
John Doe III
-----------------------------------------------------------------------
for i in `cat myname.txt`
do
echo This is my name: $i >> thi.is.my.name.txt
done
-----------------------------------------------------------------------
cat... (1 Reply)
Discussion started by: danimad
1 Replies
4. Shell Programming and Scripting
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies
5. Shell Programming and Scripting
Hallo,
ich habe eine Datei "Kino.ini" die z.B. wie folgt aussieht
* KINOFILM A
bla bla
KINOFILM B
blubb blubb
KINOFILM C
Ich möchte nun die Datei "Kino.ini" per cat und grep auslesen und testen ob der String KINOFILM nur mit einem '*' am Anfang vorkommt. In dieser Beispieldatei... (3 Replies)
Discussion started by: ABE2202
3 Replies
6. Shell Programming and Scripting
Hi Everyone,
I have a file: a.txt
a,b,c,d,6,6,6
1,2,3,d,6,6,6
4,5,6,6,6,6,6
#!/usr/bin/perl
use warnings;
use strict;
my @array = ();
### Load file into array
for my $i (split '\n', `cat /tmp/a.txt`) {
push @array, ;
}
It works. But my a.txt have 1million lines, and... (2 Replies)
Discussion started by: jimmy_y
2 Replies
7. Shell Programming and Scripting
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies
8. Shell Programming and Scripting
Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help.
pesudo code
if == ENDSINFIVEINTS ]]; then
do... (4 Replies)
Discussion started by: briandanielz
4 Replies
9. Shell Programming and Scripting
hello,
i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case
i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N.
for case 1, I want to stretch N to fit M
arrayHuge
H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
LEARN ABOUT ULTRIX
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)