Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Solaris - Filter columns in text file and adding new column Post 302859063 by jpbastos on Wednesday 2nd of October 2013 09:37:06 AM
Old 10-02-2013
Thank you very much for the reply, it has helped me a lot!!!

However I need an extra upgrade I guess shouldn´t be too complicated to implement:

The awk command gave me the result I needed, however I will need to change thresholds depending on the domain (eg: EH, ERP, etc), and above that add 2 extra columns with the min and max thresholds that are set for that row.

NOW:
Code:
 
awk '($5>=0&&$5<=10){a=0}($5>=11&&$5<=100){a=1}($5>100){a=2}{printf("%-40s %-10s %-10s\n",$1,$5,a)}' file
 
RESULT FILE:
EH.ERROR.ADB_INSERT                      11     1
EH.ERROR.ADB_UPDATE                       0     0
ERP.SAP-PI.bpmMensagemSMS.EH            234     2
ERRORHANDLER.UI.CFG.POLICY.REQUEST     1000     2
 
 
Now what I am trying to do is some if condition to distinguish the thresholds by domain, and add the 2 columns with the set low and max thresholds, like (example EH with lower thresholds and ERP with higher)
 
ORIGINAL FILE:
 
EH.ERROR.ADB_INSERT                    ---------    5*     0       11     0.0 Kb
EH.ERROR.ADB_UPDATE                    ---------    5*     0        5     0.0 Kb
ERP.SAP-PI.bpmMensagemSMS.EH           ---+-----    5*     0      234     0.0 Kb
ERRORHANDLER.UI.CFG.POLICY.REQUEST     ---+-----    5*     0     1000     0.0 Kb
 
if EH do  awk '($5>=0&&$5<=10){a=0}($5>=10&&$5<=20){a=1}($5>20){a=2}{printf("%-40s %-10s %-10s\n",$1,$5,a)}' 
if ERP do  awk '($5>=0&&$5<=300){a=0}($5>=301&&$5<=500){a=1}($5>500){a=2}{printf("%-40s %-10s %-10s\n",$1,$5,a)}' 
else do  awk '($5>=0&&$5<=10){a=0}($5>=11&&$5<=100){a=1}($5>100){a=2}{printf("%-40s %-10s %-10s\n",$1,$5,a)}' 
file
 
RESULTS:
EH.ERROR.ADB_INSERT                      11     2   10  20
EH.ERROR.ADB_UPDATE                       0     2   10  20
ERP.SAP-PI.bpmMensagemSMS.EH            234     0    300   500
ERRORHANDLER.UI.CFG.POLICY.REQUEST     1000     2     10   100

Any help is very much appreciatted!! Thank you in advance for your time! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

Hi, I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value . For Eg . if the input file has a row : abc xyz lmn 89 lm nk o p I would like the script to create something like... (9 Replies)
Discussion started by: aYankeeFan
9 Replies

2. Shell Programming and Scripting

Adding a column to a text based on file name

Dear all, Does anyone know how I could to add a column of numbers (1s, or 2s, or..., or 6s) to two-column text files (tab-delimited), where the specific number to be added varies as a function of the file naming? Currently, each of my text files has two columns, so the column with the... (12 Replies)
Discussion started by: rlapate
12 Replies

3. Shell Programming and Scripting

Suggestions for adding columns to text file

Good afternoon to everyone, I have some input and output from various widgets that I am trying to get to play nicely together. Basically I would like to stay out of excel and be able to automate the entire process. I have read some posts here about how to use awk, nawk, etc, to do similar... (9 Replies)
Discussion started by: LMHmedchem
9 Replies

4. Shell Programming and Scripting

Adding a new column in a file with other existing columns

Hi All , Kindly help me with this soln awk '{printf "%s %7s \n", $1,$c}' infile where value of variable c I am externally giving input But executing the above command shows all the columns of infile where as I want only 1st column of infile and 2nd column should print value c (8 Replies)
Discussion started by: Pratik4891
8 Replies

5. UNIX for Dummies Questions & Answers

Adding tags to a specific column of a space delimited text file

I have a space delimited text file with two columns. I would like to add NA to the first column of the text file. Input: 19625 10.4791768259 19700 10.8146489183 19701 10.9084026759 19702 10.9861346978 19703 10.9304364984 Output: NA19625 10.4791768259 NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies

6. UNIX for Dummies Questions & Answers

Adding a column to a text file based on mathematical manipulation

Hi, I have a tab delimited text file with three different columns. I want to add an extra column to the text file. The extra column will be the second column and it will equal third column - 1. How do I go about doing that? Thanks! Input: chr1 788822 rs11240777 chr1 1008567 rs9442372... (2 Replies)
Discussion started by: evelibertine
2 Replies

7. UNIX for Dummies Questions & Answers

Adding a column to a text file with row numbers

Hi, I would like to add a new column containing the row numbers to a text file. How do I go about doing that? Thanks! Example input: A X B Y C D Output: A X 1 B Y 2 C D 3 (5 Replies)
Discussion started by: evelibertine
5 Replies

8. Shell Programming and Scripting

Reading columns from a text file and to make an array for each column

Hi, I am not so familiar with bash scripting and would appreciate your help here. I have a text file 'input.txt' like this: 2 3 4 5 6 7 8 9 10 I want to store each column in an array like this a ={2 5 8}, b={3 6 9}, c={4 7 10} so that i can access any element, e.g b=6 for the later use. (1 Reply)
Discussion started by: Asif Siddique
1 Replies

9. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

10. Shell Programming and Scripting

Help in adding text before columns in shell script

Hello, Can someone please help in below requirement. My requirement is to add date before to first column,some text before 1st,2nd coulmns and insert a new column in between 2 and 3 columns. input file. aa 123 dddd aa 667 kdkdk ddj 738 kkkk aa 123 dddd aa 667 ... (5 Replies)
Discussion started by: Cva2568
5 Replies
yuvdenoise(1)							MJPEG tools manual						     yuvdenoise(1)

NAME
yuvdenoise - Motion-Compensating-YUV4MPEG2-frame-denoiser SYNOPSIS
yuvdenoise [options] </dev/stdin >/dev/stdout DESCRIPTION
yuvdenoise is a spatio-temporal noise-filter for YUV4MPEG2 streams. This is useful to reduce the bitrate needed to encode your captured movies for VCD and SVCD creation. OPTIONS
yuvdenoise accepts the following options: -g y,u,v [0..255] Gaussian filter thresholds This sets the thresholds for the gaussian filter. A value of 0 disables filtering for a specific component and 0,0,0 completely dis- ables/bypasses the filter. This filter is applied before the temporal (-t) filter. (default=0,0,0) -m y,u,v [0..255] Pre 3D Median filter thresholds This sets the thresholds for the pre-processing 3D median filter. A value of 0 disables median filtering for a specific component and 0,0,0 completely disables/bypasses the filter. This filter is applied before the temporal (-t) filter. (default=0,0,0) -r y,u,v [0..255] Renoising filter thresholds This sets the thresholds for adding random "noise" back into the video stream. Default is disabled (not adding random noise). This filter, if enabled, is run as the Blast filter (after the median and temporal filters). Reasonable value is 4,8,8 but if you are work- ing with monochrome (black and white movie) then 4,0,0 will speed things up by not processing the chroma planes. (default=0,0,0) -t y,u,v [0..255] Temporal noise-filter thresholds This sets the thresholds for the temporal noise-filter. Values above 12 may introduce ghosting. The default value for Y' (y) is often a little high and reducing it to 4 or 5 may be necessary. If the chroma smears or ghosts try using values of 5 or 6 instead of the default (12). A value of 0 disables temporal filtering for the specified component (0,0,0 disables/bypasses all temporal filtering). Thus for black and white movies 4,0,0 will be faster by not denoising the chroma planes. (default=4,8,8) -M y,u,v [0..255] Post 3D Median filter thresholds This sets the thresholds for the post-processing 3D median filter. A value of 0 disables median filtering for a specific component and 0,0,0 completely disables/bypasses the filter. This filter is applied after the temporal (-t) filter. Reasonable value is 4,8,8 but if you are working with monochrome (black and white movie) then 4,0,0 will speed things up by not processing the chroma planes. (default=0,0,0) HOW IT WORKS
To Be Written (maybe) in the future. TYPICAL USAGE AND TIPS
As it is self-adapting to the noise-situation found in the stream you normally just can go without any options set: lav2yuv my-video.avi | yuvdenoise | mpeg2enc -t 1 -o my-video.m1v AUTHOR
This man page was written by Stefan Fendt <stefan@lionfish.ping.de> and revised by Steven Schultz. ADDITIONAL INFO
If you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is: mjpeg-users@lists.sourceforge.net For more info, see our website at http://mjpeg.sourceforge.net/ SEE ALSO
mjpegtools(1), mpeg2enc(1) lavrec(1) lav2yuv(1) MJPEG Linux Square 11th August 2005 yuvdenoise(1)
All times are GMT -4. The time now is 10:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy