Sponsored Content
Full Discussion: [awk] Math & Bold-Font?
Top Forums Shell Programming and Scripting [awk] Math & Bold-Font? Post 302935049 by sea on Thursday 12th of February 2015 01:07:35 PM
Old 02-12-2015
To get this right:
Split takes column 2, splits the string at the x's and saves its output in an array(like) variable for later usage.
Sadly, pixels get calculated to 0 Smilie but the bold text is working, thank you. Smilie

I'm now stuck at further parsing of bitrates, i'd like to put a 'kb' at its end as long bitrates do not exceed 1mb, then 'mb' should be appended.
Code:
	$AWK '/^#/ { next } ;
	{ 
		bitrate=$3+$4;
		switch (length(bitrates)) {
			case >=4:
				ext=mb
			default:
				ext=kb
		}
		
		split($2, A, "x");
		pixels=A[0] * A[1];
		print "\t* "BOLD$1RESET"\t"$2"\t"pixels"\t"$3"\t"$4"\t"bitrate""ext"\t"$5"\t"$6;
	}' BOLD="\033[1m" RESET="\033[0m" UNDERLINE="\033[4m" "$PRESETS"

But this doesnt show any output at all Smilie

Thank you in advance

EDIT:
So with Scrutinizer's suggestion, and commented out the switch block,
Code:
$AWK '/^#/ { next } ;
	{ 
		bitrate=$3+$4;
		#switch (length(bitrates)) {
		#	case >=4:
		#		ext=mb
		#	default:
		#		ext=kb
		#}
		
		split($2, A, "x");
		pixels=A[0] * A[1];
		print "\t* "BOLD$1RESET,$2 "   ",pixels,$3,$4,bitrate ext,$5,$6;
	}' BOLD="\033[1m" RESET="\033[0m" UNDERLINE="\033[4m" OFS="\t" "$PRESETS"

i get this:
Code:
	  Label	Resolution 	Pixels	Vidbit	Audbit	Bitrate	1min	Comment
	* scrn	resolve   	0	1024	192	1216	?	This
	* qvga	320x240   	0	240	128	368	2.8mb	Quarter
	* hvga	480x320   	0	320	128	448	3.3mb	Half
	* nhd	640x360   	0	512	192	704	5.2mb	Ninth
	* vga	640x480   	0	640	192	832	6.1mb	VGA
	* a-vga	640x480   	0	512	192	704	5.2mb	VGA,
	* wvga	768x480   	0	768	192	960	7.6mb	Wide
	* dvd	720x480   	0	720	256	976	7.2mb	DVD
	* wdvd	720x576   	0	800	256	1056	7.7mb	DVD-wide
	* fwvga	854x480   	0	768	256	1024	7.5mb	DVD-wide
	* hd	1280x720   	0	1024	384	1408	10.1mb	HD
	* a-hd	1280x720   	0	768	256	1024	8.5mb	HD,
	* fhd	1920x1080   	0	1792	384	2176	16.7mb	Full
	* a-fhd	1920x1080   	0	1280	256	1536	12.4mb	Full
	* qhd	2560x1440   	0	3072	448	3520	26.9mb	Quad
	* uhd	3840x2160   	0	5120	512	5632	43.4mb	4K,

Regarding the comments, do i need to have to blindly append columns after $6, so all the words of any possible comments become shown?

Thank you

Last edited by sea; 02-12-2015 at 02:16 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk logic and math help

Hi, My file has 2 fields and millions of lines. variableStep chrom=Uextra span=25 201 0.5952 226 0.330693 251 0.121004 276 0.0736858 301 0.0646982 326 0.0736858 401 0.2952 426 0.230693 451 0.221004 476 0.2736858 Each field either has a... (6 Replies)
Discussion started by: wyarosh
6 Replies

2. UNIX for Dummies Questions & Answers

colored/highlighted/bold matching pattern with awk ???

Hi ! Just wondering, is it possible to color or highlight or underline a matching pattern with awk ? Or write it in bold, italic.....? (3 Replies)
Discussion started by: lucasvs
3 Replies

3. Shell Programming and Scripting

Need help with AWK math

I am trying to do some math, so that I can compare the average of six numbers to a variable. Here is what it looks like (note that when I divide really big numbers, it isn't a real number): $ tail -n 6 named.stats | awk -F\, '{print$1}' 1141804 1140566 1139429 1134210 1084682 895045... (3 Replies)
Discussion started by: brianjb
3 Replies

4. Shell Programming and Scripting

output text in bold font using SED

hi I want to write a script, while using the SED editor, to output the text, in this case a variable, to the result file but highlighted it in bold, is it possible to do that? can you tell me how? eg. in text.txt sed '$ a\ '$variable' ' <text.txt >text2.txt so it will add the... (2 Replies)
Discussion started by: piynik
2 Replies

5. Shell Programming and Scripting

awk math and csv output

Hi I have this list 592;1;Z:\WB\DOCS;/FS3_100G/FILER112/BU/MPS/DOCS;;;;\\FILER112\BUMPS-DOCS\;580,116,544,878 Bytes;656,561 ;77,560 592;2;Z:\WB\FOCUS;/FS3_100G/FILER112/BU/MPS/FOCUS;;;;\\FILER112\BUMPS-FOCUS\;172,430 Bytes;6 ;0 ... (12 Replies)
Discussion started by: nakaedu
12 Replies

6. Shell Programming and Scripting

awk in horizontal and vertical math

Based on input ail,UTT,id1_0,COMBO,21,24,21,19,85 al,UTHAST,id1_0,COMBO,342,390,361,361,1454 and awk code as awk -F, '{ K=0; for(i=NF; i>=(NF-4); i--) { K=K+$i; J=J+$i;} { print K } } END { for ( l in J ) printf("%s ",J); }' I'm trying to add columns and lines in single line. line... (6 Replies)
Discussion started by: busyboy
6 Replies

7. Shell Programming and Scripting

awk --> math-operation in a array

Hi main object is categorize the difference of data-values (TLUFT02B - TLUFT12B). herefor i read out data-files which are named acording to the timeformat yyyymmddhhmm. WR030B 266.48 Grad 0 WR050B 271.46 Grad 0 WR120B 268.11 Grad 0 WV030B 2.51 m/s ... (6 Replies)
Discussion started by: IMPe
6 Replies

8. Shell Programming and Scripting

Count math using awk

Hi expert, I have log : TOTAL-TIME : 2125264636 DATA-BYTES-DOWN : 3766111307032 DATA-BYTES-UP : 455032157567 DL = (3766111307032/2125264636)/1024 = 1.73 UL = (455032157567/2125264636)/1024 = 0.21 I want the result : TOTAL = 1.94 ... (4 Replies)
Discussion started by: justbow
4 Replies

9. Shell Programming and Scripting

Math count %memory using awk

Hi expert, i have log this: Memory: 74410384 Memory: 75831176 Memory: 77961232 Memory: 77074656 Memory: 76086160 Memory: 77128592 Memory: 78045384 Memory: 76696040 Memory: 72401176 Memory: 72520016 Memory: 72137016 Memory: 73175832 Memory: 73034528 Memory: 71770736 Memory:... (4 Replies)
Discussion started by: justbow
4 Replies

10. What is on Your Mind?

Slowly Removing Bold Font Style - Step-by-Step

FYI, I'm slowly removing a lot of the bold font-styles from titles of discussions, forum titles, etc I'm not removing bold for the entire site because we do need bold from time to time, especially in posts and sometimes in other places. However, the original forum style had way too much... (3 Replies)
Discussion started by: Neo
3 Replies
comet(7)						 Miscellaneous Information Manual						  comet(7)

NAME
comet - PowerStorm 4D10T, Elsa GLoria, IntraServer Combo device driver SYNOPSIS
config_driver comet pseudo-device ws config_driver pci callout after_c "../bin/mkdata pci" DESCRIPTION
The PowerStorm 4D10T, Elsa GLoria, and IntraServer Combo cards are inexpensive graphics accelerators based on 3DLabs' Permedia2 graphics chip. Supported cards offer up to 8MB of video memory and a large range of video formats. Hardware Variants The following three configurations are supported: 8 MB of video memory. PCI Vend_ID: 0x104c, Dev_ID: 0x3d07, Sub_Vend_ID: 0x1011, Sub_Dev_ID: 0x4d10. 8 MB of video memory. PCI Vend_ID: 0x104c, Dev_ID: 0x3d07, Sub_Vend_ID: 0x1048. Combination card with PCI-PCI bridge chip, P2 graphics device, and one or two ethernet controllers. The graphics component has 4MB of video memory. PCI Vend_ID: 0x3d3d, Dev_ID: 0x0009. Display Resolution The following table details the display resolutions that are supported by these cards. Setting the resolution is a task performed by the X Server and the associated documentation should be read for the particulars of the mechanisms used. Before setting a video mode, consult the documentation for the monitor attached to the graphics adapter to verify compatibility with the desired refresh rate and resolution. Monitors can be damaged to the point of doing physical damage to the monitor, other objects, and humans. Hvis Vvis Fv Fh Fp Htot Hfp Hsyn Hbp Vtot Vfp Vsyn Vbp 640 480 60 29.82 23.86 800 16 64 80 497 1 3 13 640 480 65 32.31 25.84 800 16 64 80 497 1 3 13 640 480 70 34.79 27.83 800 16 64 80 497 1 3 13 640 480 75 37.65 30.72 816 24 64 88 502 1 3 18 640 480 85 42.92 35.71 832 32 64 96 505 1 3 21 800 600 60 37.68 39.79 1056 40 128 88 628 1 4 23 800 600 65 40.82 43.11 1056 40 128 88 628 1 4 23 800 600 70 43.96 46.42 1056 40 128 88 628 1 4 23 800 600 75 46.88 49.50 1056 16 80 160 625 1 3 21 800 600 85 53.64 56.21 1048 32 64 152 631 1 3 27 1024 768 60 48.36 65.00 1344 24 136 160 806 4 6 28 1024 768 65 52.39 70.41 1344 24 136 160 806 4 6 28 1024 768 70 56.42 75.83 1344 24 136 160 806 4 6 28 1024 768 75 60.00 78.72 1312 16 96 176 800 1 3 28 1024 768 85 68.68 94.50 1376 48 96 208 808 1 3 36 1152 870 60 54.36 86.98 1600 64 128 256 906 1 3 32 1152 870 65 58.59 94.22 1600 64 128 256 906 1 3 32 1152 870 70 63.42 101.47 1600 64 128 256 906 1 3 32 1152 870 75 67.95 108.72 1600 64 128 256 906 1 3 32 1152 870 85 77.61 122.31 1576 64 128 232 913 1 3 39 1152 900 60 56.58 85.10 1504 32 128 192 943 2 8 33 1152 900 65 61.30 92.19 1504 32 128 192 943 2 8 33 1152 900 70 66.01 99.28 1504 32 128 192 943 2 8 33 1152 900 75 70.73 106.37 1504 32 128 192 943 2 8 33 1152 900 85 80.16 120.55 1504 32 128 192 943 2 8 33 1280 1024 60 63.96 107.96 1688 48 112 248 1066 1 3 38 1280 1024 65 69.10 117.19 1696 32 112 224 1063 3 3 33 1280 1024 70 74.41 126.20 1696 32 160 224 1063 3 3 33 1280 1024 75 79.95 134.96 1688 16 144 248 1066 1 3 38 1280 1024 85 91.12 157.46 1728 48 160 240 1072 1 3 44 1600 1200 60 75.00 162.00 2160 64 192 304 1250 1 3 46 1600 1200 65 81.25 175.50 2160 64 192 304 1250 1 3 46 1600 1200 70 87.50 189.00 2160 64 192 304 1250 1 3 46 1600 1200 75 93.75 202.50 2160 64 192 304 1250 1 3 46 1600 1280 60 80.28 173.40 2160 64 192 304 1338 1 3 54 1600 1280 65 86.97 187.86 2160 64 192 304 1338 1 3 54 1600 1280 70 93.66 202.21 2160 64 192 304 1338 1 3 54 1600 1280 75 100.35 216.76 2160 64 192 304 1338 1 3 54 1920 1080 60 67.50 159.84 2368 32 144 272 1125 3 3 39 1920 1080 65 73.13 173.16 2368 32 144 272 1125 3 3 39 1920 1080 70 78.75 186.48 2368 32 144 272 1125 3 3 39 1920 1080 75 84.38 199.80 2368 32 144 272 1125 3 3 39 1920 1200 60 75.00 193.80 2584 72 256 336 1250 3 3 44 1920 1200 65 81.25 209.95 2584 72 256 336 1250 3 3 44 1920 1200 70 87.50 226.10 2584 72 256 336 1250 3 3 44 1920 1200 75 93.75 242.25 2584 72 256 336 1250 3 3 44 Table Legend: Hvis - Visible pixels in a line (e.g. width). Vvis - Visible lines in a field (e.g. height). Fv - Vertical refresh rate in Hz. Fh - Horizontal sync pulse frequency in KHz. Fp - Pixel clock frequency in MHz. Htot - Pixel-equivalent duration of the full horizontal scanning period. Hfp - Pixel-equivalent duration of the horizontal front porch. Hsyn - Pixel-equivalent duration of the horizontal sync pulse. Hbp - Pixel-equivalent duration of the horizontal back porch. Vtot - Line-equivalent duration of the full vertical scan- ning period. Vfp - Line-equivalent duration of the vertical front porch. Vsyn - Line-equivalent duration of the vertical sync pulse. Vbp - Line-equivalent duration of the vertical back porch. Device Configuration The comet driver supports up to 15 devices in a single system. Prior releases of the system software supported seven or fewer devices. Other software, such as the X Server or base operating system, may put additional restrictions on the number of units supported. Device Description In PCI-based systems, no more than one VGA device can be configured into the system. The comet cards typically have a jumper or miniature switch to enable and disable VGA operations. MESSAGES
Device driver messages are typically logged to /var/adm/ messages on UNIX systems. Should problems arise, this file should be checked for informational messages. Some messages of interest are: "comet0: %dx%d cursor glyph truncated to hardware limits" The X Server attempted to use a cursor larger than the 64x64 limits of the hardware. Cursor glyph will be displayed incorrectly. Applica- tion should be brought into conformance with X11 expectations. "comet0: Video pixel fifo underflowed during previous video format" The flow of pixel data from video memory to the video DACs was exhausted possibly causing visual artifacts on the display. It is permissi- ble and expected that this may occur once shortly after booting when the device hasn't been configured. But otherwise, this should be reported to your technical support organization, including in the description the video format currently in use as well as the application running at the time. FILES
The driver module, built into a kernel with the doconfig command. RELATED INFORMATION
Xdec(1X) delim off comet(7)
All times are GMT -4. The time now is 09:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy