Sponsored Content
Top Forums Shell Programming and Scripting Print String Every Specific Line Post 302766479 by Don Cragun on Monday 4th of February 2013 09:50:07 PM
Old 02-04-2013
Try something like:
Code:
awk 'BEGIN {
        p[0] = "DD"
        p[1] = "AA"
        p[2] = "BB"
        p[3] = "CC"
}
{       printf("%s %s\n", p[NR % 4], $0)}' input

As always, if you are using a Solaris/SunOS system, use /usr/xpg4/bin/awk or nawk instead of awk.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print lines with search string at specific position

Hi Folks, I have a file with all fields defined by byte position, but any field can be empty so I cannot print lines based on a search of specific columns. I need to print all lines of this file where the string of two characters at byte position 100-101 contains the number 27. Any ideas? ... (4 Replies)
Discussion started by: HealthyGuy
4 Replies

2. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

3. Shell Programming and Scripting

search a word and print specific string using awk

Hi, I have list of directory paths in a variable and i want to delete those dirs and if dir does not exist then search that string and get the correct path from xml file after that delete the correct directory. i tried to use grep and it prints the entire line from the search.once i get the entire... (7 Replies)
Discussion started by: dragon.1431
7 Replies

4. Shell Programming and Scripting

Select a specific part of the string and print it

Hi all, I have a string that looks like: #!/bin/sh options="arguments: --user=alpha --group=beta --prefix=/usr/share --proxy-path=/proxy --proxy-tmp=/tmp --conf-path=/etc" My goal is to transform the string into an array, then for each key, if it starts with "--proxy" to print the string... (2 Replies)
Discussion started by: TECK
2 Replies

5. Shell Programming and Scripting

search-word-print-specific-string

Hi, Our input xml looks like: <doc> <str name="account_id">1111</str> <str name="prd_id">DHEP155EK</str> </doc> - <doc> <str name="account_id">6666</str> <str name="prd_id">394531662</str> </doc> - <doc> <str name="account_id">6666</str> <str... (1 Reply)
Discussion started by: Jassz
1 Replies

6. Shell Programming and Scripting

Need awk help to print specific columns with as string in a header

awk experts, I have a big file of 4000 columns with header. Would like to print the columns with string value of "Commands" in header. File has "," separator. This file is on ESX host with Bash. Thanks, Arv (21 Replies)
Discussion started by: arv_cds
21 Replies

7. Shell Programming and Scripting

break the string and print it in a new line after a specific word

Hi Gurus I am new to this forum.. I am using HP Unix OS. I have one single string in input file as shown below Abc123 | cde | fgh | ghik| lmno | Abc456 |one |two |three | four | Abc789 | five | Six | seven | eight | Abc098 | ........ I want to achive the result in a output file as shown... (3 Replies)
Discussion started by: kannansr621
3 Replies

8. UNIX for Dummies Questions & Answers

How to Detect Specific Pattern and Print the Specific String after It?

I'm still beginner and maybe someone can help me. I have this input: the great warrior a, b, c and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this : Warrior Type a b c Im still very... (3 Replies)
Discussion started by: radynaraya
3 Replies

9. Shell Programming and Scripting

awk - how to print specific field if a string is matched

hi gurus, I would like to be able to use awk to process 1 file as such: abc 1 2 3 4 5 6 7 8 9 10 flags 1 2 4 flags 1 2 5 abc 2 3 4 5 6 7 8 9 10 11 flags 1 2 3 abc 4 5 6 7 8 9 6 7 78 89 flags 1 2 3 flags 1 2 4 flags 1 2 3 4 I would like to be able to print field 1 and 5 when the... (4 Replies)
Discussion started by: revaroo
4 Replies

10. Shell Programming and Scripting

awk to print string if tag is specific value

In the below awk I am trying to print expName only if another tag planExecuted is true. In addition to the expName I am also printing planShortID. For some reason the word experiment gets printed so I remove it with sed. I have attached the complete index.html as well as included a sample of it... (1 Reply)
Discussion started by: cmccabe
1 Replies
PCOND(1)						      General Commands Manual							  PCOND(1)

NAME
pcond - condition a RADIANCE picture for output SYNOPSIS
pcond [ options ] input [ output ] DESCRIPTION
Pcond conditions a Radiance picture for output to a display or hard copy device. If the dynamic range of the scene exceeds that of the display (as is usually the case), pcond will compress the dynamic range of the picture such that both dark and bright regions are visible. In addition, certain limitations in human vision may be mimicked in order to provide an appearance similar to the experience one might have in the actual scene. Command line switches turn flags off and on, changing program behavior. A switch given by itself toggles the flag from off to on or on to off depending on its previous state. A switch followed by a '+' turns the option on explicitly. A switch followed by a '-' turns the option off. The default is all switches off. Other options specify output device parameters in order to get more accurate color and con- trast. -h[+-] Mimic human visual response in the output. The goal of this process is to produce output that correlates strongly with a per- son's subjective impression of a scene. This switch is a bundle of the -a, -v, -s and -c options. -a[+-] Defocus darker regions of the image to simulate human visual acuity loss. This option will not affect well-lit scenes. -v[+-] Add veiling glare due to very bright regions in the image. This simulates internal scattering in the human eye, which results in a loss of visible contrast near bright sources. -s[+-] Use the human contrast sensitivity function in determining the exposure for the image. A darker scene will have relatively lower exposure with lower contrast than a well-lit scene. -c[+-] If parts of the image are in the mesopic or scotopic range where the cone photoreceptors lose their efficiency, this switch will cause a corresponding loss of color visibility in the output and a shift to a scotopic (blue-dominant) response function. -w[+-] Use a center-weighted average for the exposure rather than the default uniform average. This may improve the exposure for scenes with high or low peripheral brightness. -i fixfrac Set the relative importance of fixation points to fixfrac, which is a value between 0 and 1. If fixfrac is zero (the default), then no fixation points are used in determining the local or global adaptation. If fixfrac is greater than zero, then a list of fixation points is read from the standard input. These points are given as tab-separated (x,y) picture coordinates, such as those produced by the -op option of ximage(1). The foveal samples about these fixation points will then be weighted together with the global averaging scheme such that the fixations receive fixfrac of the total weight. If fixfrac is one, then only the fixation points are considered for adaptation. -I[+-] Rather than computing a histogram of foveal samples from the source picture, use the precomputed histogram provided on the stan- dard input. This data should be given in pairs of the base-10 logarithm of world luminance and a count for each bin in ascending order, as computed by the phisto(1) script. This option is useful for producing identical exposures of multiple pictures (as in an animation), and provides greater control over the histogram computation. -l[+-] Use a linear response function rather than the standard dynamic range compression algorithm. This will prevent the loss of usable physical values in the output picture, although some parts of the resulting image may be too dark or too bright to see. -e expval Set the exposure adjustment for the picture to expval. This may either be a real multiplier, or a (fractional) number of f-stops preceeded by a '+' or '-'. This option implies a linear response (see the -l option above). -u Ldmax Specifies the top of the luminance range for the target output device. That is, the luminance (in candelas/m^2) for an output pixel value of (R,G,B)=(1,1,1). The default value is 100 cd/m^2. -d Lddyn Specifies the dynamic range for the target output device, which is the ratio of the maximum and minimum usable display lumi- nances. The default value is 32. -p xr yr xg yg xb yb xw yw Specifies the RGB primaries for the target output device. These are the 1931 CIE (x,y) chromaticity values for red, green, blue and white, respectively. -f macbeth.cal Use the given output file from macbethcal(1) to precorrect the color and contrast for the target output device. This does a more thorough job than a simple primary correction using the -p option. Only one of -f or -p may be given. -x mapfile Put out the final mapping from world luminance to display luminance to mapfile. This file will contain values from the minimum usable world luminance to the maximum (in candelas/m^2) in one column, and their corresponding display luminance values (also in candelas/m^2) in the second column. This file may be used for debugging purposes, or to plot the mapping function created by pcond. EXAMPLES
To display an image as a person might perceive it in the actual scene: pcond -h final.hdr > display.hdr ximage display.hdr ; rm display.hdr & To do the same on a 24-bit display with known primary values: setenv DISPLAY_PRIMARIES ".580 .340 .281 .570 .153 .079 .333 .333" pcond -h -p $DISPLAY_PRIMARIES final.hdr | ximage & To prepare a picture to be sent to a film recorder destined eventually for a slide projector with a minimum and maximum screen luminance of 1.5 and 125 candelas/m^2, respectively: pcond -d 83 -u 125 final.hdr > film.hdr To do the same if the output colors of the standard image "ray/lib/lib/macbeth_spec.hdr" have been measured: macbethcal -c mbfilm.xyY > film.cal pcond -d 83 -u 125 -f film.cal final.hdr > film.hdr To further tweak the exposure to bring out certain areas indicated by dragging the right mouse button over them in ximage: ximage -op -t 75 final.hdr | pcond -i .5 -d 83 -u 125 -f film.cal final.hdr > film.hdr To use a histogram computed on every 10th animation frame: phisto frame*0.hdr > global.hist pcond -I -s -c frame0352.hdr < global.hist | ra_tiff - frame0352.tif REFERENCE
Greg Ward Larson, Holly Rushmeier, Christine Piatko, ``A Visibility Matching Tone Reproduction Operator for High Dynamic Range Scenes,'' IEEE Transactions on Visualization and Computer Graphics , December 1997. http://www.sgi.com/Technology/pixformat/Larsonetal.html AUTHOR
Greg Ward Larson SEE ALSO
getinfo(1), macbethcal(1), normtiff(1), pcompos(1), pflip(1), phisto(1), pinterp(1), pvalue(1), protate(1), ra_xyze(1), rad(1), rpict(1), ximage(1) RADIANCE
10/27/98 PCOND(1)
All times are GMT -4. The time now is 02:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy