08-11-2012
Quote:
Originally Posted by
SkySmart
sorry about that. i meant to have all of them to be "===="
but why would u be nervous about doing this for large input files? is there a better solution?
That make it a little bit easier. You don't have to save the $2 values when you read a record, calculate the maximum field width for $2, and the output format string for the 2nd field just has "====" instead of having to print a string with the width of the longest $2 input value.
The determination of what a "large" file is depends on the size of your input file, the amount of memory on the machine, and the load on the machine. If you can figure out the maximum field widths for each field before you start reading the data and can build in the output format string instead of computing it on the fly, you don't have to store the entire file in awk's address space.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I use vi for my text editing. Is there a way to use smart indentation?
that is when adding a '{' or '}' that the editor will jump and advance, or any other thing like that?
thanks (1 Reply)
Discussion started by: sierra_aar
1 Replies
2. UNIX for Dummies Questions & Answers
I know this is not a unix question but I also know that many of you use vim editor every day. So hoping to get some help, here it goes:
How can I change my vim config file so that the indentations while c programming take 4 spaces instead of 8?
I want the change to apply any further uses of... (4 Replies)
Discussion started by: Virtuosso
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I'm working on a big project and all the CPP and header files are in mess with respect to indentation. I would like to indent whole file(s) at once (like ctrl-shift-f in eclipse). Is there anybody who knows how to do that in vi/vim?
thanks (2 Replies)
Discussion started by: SaTYR
2 Replies
4. Shell Programming and Scripting
Good morning!!
Im trying to create a script that should get a list of numbers from the user (using STDIN or a list of arguments), and call my library function.
#!use/bin/perl
require 'my-lib.pl';
@userArray = <STDIN>;
while()
{
chomp;
last if ! /\d/;
push(@userArray,&_);
}... (2 Replies)
Discussion started by: bigben1220
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'm working with gvim, and opened an old file for editing.
the file 'older' indents are diffrent from the current and I wish to set the file to cahnge the whole file to the new indenting setting at once.
How can it be done?
thnx. (0 Replies)
Discussion started by: cvs_eng
0 Replies
6. Shell Programming and Scripting
Every now and then I have to indent the lines in my script to 4 space characters.
I generally do it line by line.
Is there an automated command in vi using which I can indent some set of lines to desired number of space characters in one go. (2 Replies)
Discussion started by: paragkalra
2 Replies
7. Shell Programming and Scripting
hi all,
i was wondering if there is an easy and smart way of greping for requestname (in bold below) from xml output from application log file on a solaris 10 system.
The requestName is the actual method name which gets called e.g it could be 'getAccount' or getId or getAddress etc etc
... (1 Reply)
Discussion started by: cesarNZ
1 Replies
8. Shell Programming and Scripting
Can anyone tell me if it's possible to write a script that will repeat the same job several times but give the output a slightly different name each time (i.e. change or add a number at the end of the output file)? Here is the script I use to run a single job:
#!/bin/bash
#PBS -N job0
#PBS -l... (1 Reply)
Discussion started by: peterjb100
1 Replies
9. Shell Programming and Scripting
A space, a tab? Just currious what, why, you indent in x way?
Fwiw, I use vi, so kind'a currious how you vi folks approach indentation when writing code (eg python).
Disclosure, I'm just learning python and have never seen a language use indentation so formally (I like it too:) ). I just... (7 Replies)
Discussion started by: sas
7 Replies
10. Shell Programming and Scripting
#!/bin/sh
# This script returns the number of rows updated from a function
echo "The execution is starting ....."
sqlplus -silent $UP <<EOF
set serveroutput on
set echo off
set pagesize 0
VAR no_rows_updated NUMBER;
EXEC :no_rows_updated :=0;
DECLARE
CURSOR c_update is
SELECT * FROM... (4 Replies)
Discussion started by: LoneRanger
4 Replies
LEARN ABOUT MINIX
genskyvec
GENSKYVEC(1) General Commands Manual GENSKYVEC(1)
NAME
genskyvec - compute patch radiance averages for a specific sky
SYNOPSIS
genskyvec [ -m N ][ -c r g b ]
DESCRIPTION
Genskyvec samples the Radinace sky description given on the standard input to generate a list of average patch radiances. If there is a
sun in the description, genskyvec will include its contribution in the three nearest sky patches, distributing energy according to centroid
proximity.
By default, genskyvec divides the sky into 2305 patches, plus one patch for the ground. This corresponds to Reinhart's extension of the
Tregenza sky, where the original 145 patches are subdivided into 16 subpatches, except at the zenith. A different subdivision may be spec-
ified via the -m option. The value given will be used to subdivide each dimension, so the default of 4 yields almost 16 times as many
patches as the original Tregenza sky, which can be specified with -m 1. A higher resolution sky is generally better for daylight coeffi-
cient analysis where solar position is important.
The -c option may be used to specify a color for the sky. The gray value should equal 1 for proper energy balance The default sky color is
-c 0.960 1.004 1.118 .
EXAMPLE
To generate 578 patches corresponding to a 2x2 subdivision of the Tregenza sky on a sunny equinox noon:
gensky 9 21 12 | genskyvec -m 2 > sky09_21_12.dat
AUTHOR
Greg Ward
SEE ALSO
dctimestep(1), genBSDF(1), gensky(1), gentregvec(1), rtcontrib(1), rtrace(1)
RADIANCE
12/09/09 GENSKYVEC(1)