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
NORMTIFF(1)						      General Commands Manual						       NORMTIFF(1)

NAME
normtiff - tone-map and convert RADIANCE picture or HDR TIFF to standard TIFF SYNOPSIS
normtiff [ options ] input output.tif DESCRIPTION
Normtiff prepares a Radiance picture or high dynamic-range TIFF 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), normtiff 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. Output is always an uncompressed RGB TIFF, which must be named on the command line along with the input file. If the input file has a ".tif" or ".tiff" extension, normtiff attempts to read it as a TIFF. Otherwise, normtiff first tries opening it as a RADIANCE picture, only opening it as a TIFF if it fails header inspection. (See the getinfo(1) program.) If the input is neither a RADIANCE picture nor a high dynamic-range TIFF, the program reports an error and exits. The following command line options are understood. Since this program is very similar to pcond(1), several of the switches are identical. -b Toggle 8-bit black and white (grayscale) TIFF output. If the input is a grayscale TIFF, this switch is automatically selected. Otherwise, the output defaults to 24-bit RGB. -z Output LZW-compressed TIFF (smaller file). -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 turns on both the -s and -c switches, described below. -s Toggle the use of 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 Toggle mesopic color correction. 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. -l Toggle the use of a linear response function versus the standard dynamic range compression algorithm. This may make some parts of the resulting image too dark or too bright to see. -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)=(255,255,255). This parameter affects tone mapping only when the -s switch is on. 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, which is typical for CRT monitors. -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. -g gamma Specifies the output device gamma correction value. The default value is 2.2, which is appropriate for most CRT monitors. (A value of 1.8 is common in color prepress and color printers.) EXAMPLES
To convert a RADIANCE picture to an 8-bit grayscale TIFF: normtiff -b scene.hdr sceneb.tif To condition a high dynamic-range TIFF for a particular film recorder with known color primaries, dynamic range and gamma response: pcond -d 50 -g 2.5 -p .580 .340 .281 .570 .153 .079 .333 .333 orig.tif filmrgb.tif To simulate human visual response on a monitor with known maximum luminance: normtiff -h -u 80 scene.hdr sceneh.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://positron.cs.berkeley.edu/gwlarson/pixformat/ AUTHOR
Greg Ward Larson ACKNOWLEDGMENT
This work was supported by Silicon Graphics, Inc. SEE ALSO
getinfo(1), pcond(1), pflip(1), pvalue(1), protate(1), ra_xyze(1), rpict(1), ximage(1) RADIANCE
2/25/99 NORMTIFF(1)
All times are GMT -4. The time now is 08:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy