Sponsored Content
Top Forums Shell Programming and Scripting Fill the values between -500 to 500 -awk Post 302460227 by Klashxx on Wednesday 6th of October 2010 08:59:40 AM
Old 10-06-2010
If you want to use Python:

Code:
#!/usr/bin/python

import sys

fname=sys.argv[1]

kd={}
for line in open(fname):
    k,v = line.split()
    kd[k] = v
 
for i in range(-500,501):
    if str(i) in kd:
       print '%s %s' % (i,kd[str(i)])
    else:
       print '%s 0' % i

Usage:
Code:
script.py input:file

 

8 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Linux Notebook for $500

Balance 14.1" Notebook Computer with CD-ROM Drive (2 Replies)
Discussion started by: Perderabo
2 Replies

2. Windows & DOS: Issues & Discussions

HTTP Status 500

Hello all, sori my english very bad,but 1 month i search about this case and nothing can help,maybe I wrong place but please if anybody can help me about this error: java.lang.ArrayIndexOutOfBoundsException: 0 >= 0 at java.util.Vector.elementAt(Vector.java:432) at... (2 Replies)
Discussion started by: fredginting
2 Replies

3. Shell Programming and Scripting

To add more than 500 ips

Hi, I have a server, which has more than of 1000 ip address, but only 500 ip address are responding in the Server. Here below the error message received while restarting the named Sep 22 00:25:00 ns2 named: creating IPv4 interface eth0:595 failed; interface ignored Sep 22 00:25:00 ns2... (5 Replies)
Discussion started by: gsiva
5 Replies

4. IP Networking

To add more than 500 ips

To add more than 500 ips Hi, I have a server, which has more than of 1000 ip address, but only 500 ip address are responding in the Server. Here below the error message received while restarting the named Code: Sep 22 00:25:00 ns2 named: creating IPv4 interface... (2 Replies)
Discussion started by: gsiva
2 Replies

5. UNIX Desktop Questions & Answers

for loop (001 to 500)

hey, how do i create a for loop that runs for i from 001 to 500 ? i need that the zero prefix will remain so when i print "i" it will look like so: 001 002 . . 008 009 . . 058 059 . . 500 please advise. (2 Replies)
Discussion started by: boaz733
2 Replies

6. Shell Programming and Scripting

AWK splitting a string of equal parts of 500 chars

Hi , can someone help me how to make an AWK code for splitting a string of equal parts of 500 chars in while loop? Thank you! (4 Replies)
Discussion started by: sanantonio7777
4 Replies

7. Shell Programming and Scripting

Deleting all lines except last 500

Hi All, I want to write a script which first check the line counts of a file if its more than 500 it deletes rest except the last 500.. I tried sed but it looks sed counts line numbers from the head & not from tail.. May be I need a wc -l frist then apply if statement & pass on the line count... (17 Replies)
Discussion started by: ailnilanjan
17 Replies

8. War Stories

The 500 Mile Email

Not my story, but interesting enough to be worth posting here IMHO. (Original is here) The following is the 500-mile email story in the form it originally appeared, in a post to sage-members on Sun, 24 Nov 2002.: From trey@sage.org Fri Nov 29 18:00:49 2002 Date: Sun, 24 Nov 2002 21:03:02... (3 Replies)
Discussion started by: Corona688
3 Replies
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy