Sponsored Content
Full Discussion: awk to indent file outout
Top Forums Shell Programming and Scripting awk to indent file outout Post 302685149 by Don Cragun on Friday 10th of August 2012 11:38:30 PM
Old 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

Auto indent in vi

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

vim indent

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

vi auto indent whole file at once

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

creating/using libraries Perl...blank outout?

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

gvim: how to set new indent to a file (tabsize)

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

How to indent the file lines using vi?

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

getting requestName from xml outout in log file

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

Replicating jobs, renaming outout

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

Python indent - how do you do it?

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

Sql command inside shell script runs without giving anything back as outout

#!/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
GENSKY(1)						      General Commands Manual							 GENSKY(1)

NAME
gensky - generate a RADIANCE description of the sky SYNOPSIS
gensky month day time [ options ] gensky -ang altitude azimuth [ options ] gensky -defaults DESCRIPTION
Gensky produces a RADIANCE scene description for the CIE standard sky distribution at the given month, day and time. By default, the time is interpreted as local standard time on a 24-hour clock. The time value may be given either as decimal hours, or using a colon to sepa- rate hours and minutes. If the time is immediately followed (no white space) by a North American or European time zone designation, then this determines the standard meridian, which may be specified alternatively with the -m option. The following time zones are understood, with their corresponding hour differences from Greenwich Mean Time: Standard time: YST PST MST CST EST GMT 9 8 7 6 5 0 CET EET AST GST IST JST NZST -1 -2 -3 -4 -5.5 -9 -12 Daylight savings time: YDT PDT MDT CDT EDT BST 8 7 6 5 4 -1 CEST EEST ADT GDT IDT JDT NZDT -2 -3 -4 -5 -6.5 -10 -13 If the time is preceded by a plus sign ('+'), then it is interpreted as local solar time instead. It is very important to specify the cor- rect latitude and longitude (unless local solar time is given) using the -a and -o options to get the correct solar angles. The second form gives the solar angles explicitly. The altitude is measured in degrees above the horizon, and the azimuth is measured in degrees west of South. The third form prints the default option values. The output sky distribution is given as a brightness function, skyfunc. Its value is in watts/steradian/meter2. The x axis points east, the y axis points north, and the z axis corresponds to the zenith. The actual material and surface(s) used for the sky is left up to the user. For a hemispherical blue sky, the description might be: !gensky 4 1 14 skyfunc glow skyglow 0 0 4 .99 .99 1.1 0 skyglow source sky 0 0 4 0 0 1 180 Often, skyfunc will actually be used to characterize the light coming in from a window. In addition to the specification of a sky distribution function, gensky suggests an ambient value in a comment at the beginning of the description to use with the -av option of the RADIANCE rendering programs. (See rvu(1) and rpict(1).) This value is the cosine-weighted radiance of the sky in watts/steradian/meter2. Gensky supports the following options. -s Sunny sky without sun. The sky distribution will correspond to a standard CIE clear day. +s Sunny sky with sun. In addition to the sky distribution function, a source description of the sun is generated. -c Cloudy sky. The sky distribution will correspond to a standard CIE overcast day. -i Intermediate sky without sun. The sky will correspond to a standard CIE intermediate day. +i Intermediate sky with sun. In addition to the sky distribution, a (somewhat subdued) sun is generated. -u Uniform cloudy sky. The sky distribution will be completely uniform. -g rfl Average ground reflectance is rfl. This value is used to compute skyfunc when Dz is negative. Ground plane brightness is the same for -s as for +s. (Likewise for -i and +i, but see the -r option below.) -b brt The zenith brightness is brt. Zenith radiance (in watts/steradian/meter2) is normally computed from the sun angle and sky tur- bidity (for sunny sky). It can be given directly instead, using this option. -B irrad Same as -b, except zenith brightness is computed from the horizontal diffuse irradiance (in watts/meter2). -r rad The solar radiance is rad. Solar radiance (in watts/steradian/meter2) is normally computed from the solar altitude. This option may be used to override the default calculation. If a value of zero is given, no sun description is produced, and the contribu- tion of direct solar to ground brightness is neglected. -R irrad Same as -r, except solar radiance is computed from the horizontal direct irradiance (in watts/meter2). -t trb The turbidity factor is trb. Greater turbidity factors correspond to greater atmospheric scattering. A turbidity factor of 1.0 indicates an ideal clear atmosphere (i.e. a completely dark sky). Values less than 1.0 are physically impossible. The following options do not apply when the solar altitude and azimuth are given explicitly. -a lat The site latitude is lat degrees north. (Use negative angle for south latitude.) This is used in the calculation of sun angle. -o lon The site longitude is lon degrees west. (Use negative angle for east longitude.) This is used in the calculation of solar time and sun angle. Be sure to give the corresponding standard meridian also! If solar time is given directly, then this option has no effect. -m mer The site standard meridian is mer degrees west of Greenwich. (Use negative angle for east.) This is used in the calculation of solar time. Be sure to give the correct longitude also! If a time zone or solar time is given directly, then this option has no effect. EXAMPLE
To produce a sunny sky for July 4th at 2:30pm Eastern daylight time at a site latitude of 42 degrees, 89 degrees west longitude: gensky 7 4 14:30EDT +s -a 42 -o 89 To produce a sunny sky distribution for a specific sun position but without the sun description: gensky -ang 23 -40 -s FILES
/usr/share/radiance/skybright.cal AUTHOR
Greg Ward SEE ALSO
rpict(1), rvu(1), xform(1) RADIANCE
4/24/98 GENSKY(1)
All times are GMT -4. The time now is 07:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy