I need to grab the number that comes right after the equal sign "=" for each of the patterns and after getting all the numbers, I want add them up to get the total.
so in the above scenario, there is a total of 8 errors
im looking for a solution that will take into account scenarios of both output. im hoping awk can be used for this.
thank you for your code Scrutinizer. it works perfectly!
one more request.
the actual datafile looks like this:
and i run the following awk command on the data:
which normally produces an expected output similar to this:
i get the above output only if the 9th field contains a value. but if the 9th field contains the original values I posted in this thread, "Master_Item_Service_is_down=0 java_lang_NoClassDefFoundError=0 java_lang_OutOfMemoryError=1 emxCommonAppInitialization__Error_while_initializing=0 ", i get output similar to the following, which is not what i want.:
so i would like to incorporate your command into my original command that i pasted in this post, so that it adds up all the values in the 9th frield and then shows the expected output:
with the bolded being the total of all the values in that 9th column. sorry if i just made this too complicated.
Your expected output doesn't really fit what your incredibly overcomplex script will produce when applied to your input sample. Which doesn't necessarily help us help you. Nor does the missing context like the undefined shell variables.
You seem to want to print $(NF-D)"-"$3"_"$(NF-E)"----"A with D equals 1 or 2 and E equals 0 or 1 depending on the field count of the line. How about considering boiling down above to something like
Why do you print the A variable if immediately afterwards remove it again?
Your expected output doesn't really fit what your incredibly overcomplex script will produce when applied to your input sample. Which doesn't necessarily help us help you. Nor does the missing context like the undefined shell variables.
You seem to want to print $(NF-D)"-"$3"_"$(NF-E)"----"A with D equals 1 or 2 and E equals 0 or 1 depending on the field count of the line. How about considering boiling down above to something like
Why do you print the A variable if immediately afterwards remove it again?
For your $9 problem, you might want to try
and print TOT in lieu of the resp. field.
im trying to boil down the command as you suggested, but im running into issues:
Of course. You messed up the pattern {action} pair structure of awk. Try (untested)
EDIT: Actually, looking at it again, there's another logic flaw: if A ~ "(Wed|Tue)" it will ALWAYS match Mon|Tue|Wed|Thu|Fri|Sat|Sun, so the if in front of the print is pointless.
Of course. You messed up the pattern {action} pair structure of awk. Try (untested)
EDIT: Actually, looking at it again, there's another logic flaw: if A ~ "(Wed|Tue)" it will ALWAYS match Mon|Tue|Wed|Thu|Fri|Sat|Sun, so the if in front of the print is pointless.
im probably missing something here because when i run this script, it still bails out:
i have a binary data that has some text in it.
what i want to do is, i want to grab just piece of information from the binary. but when i run my awk on it, it returns nothing.
awk -F"MYINFO=" '{print $2}' mybinary
however, when i install gawk, then try again, it works.
i would prefer... (1 Reply)
The below hides the messy commands of wget
#!/bin/bash
cd 'C:\Users\cmccabe\Desktop\wget'
wget -O getCSV.txt http://172.24.188.113/data/getCSV.csv
progressfilt ()
{
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c
do
if $flag
... (5 Replies)
Need a script to print a set of characters in different combination. What's the key to accomplish this.
e.g charset: "Abcdefghij1" without quotes.
block 1: "Abcd"
block 2: "efg"
block 3: "hij1"
I need this script to change the order of the characters and print it to stdout
e.g
print out... (3 Replies)
I have a file, ENV.doc somewhere in my home directory. I want to know where the file is located in my sub directories using FIND. But, I want to display only the relative path along with the file name.
Thanks, (6 Replies)
Hi,
I am doing some testing with creation of depots on HP-UX systems (11.11).
Want to display some echo statements based on the processing during checkinstall, pre & postinstall scripts on the terminal.
The echo statements are getting directed to /var/adm/sw/swagent.log
I want to display... (7 Replies)
The input file has 3 columns. the first column with low values second with bigger.If the symbol is - in third column the numbers have to change the least in column1 and highest in col2.
Input
col1 col2 col3
1 2 +
2 3 -
3 4 +
5 6 -
Output
col1 col2 col3
1 2 +
3 2 -
3 4 +
6 5 -
The... (2 Replies)
Hey ppl
I have two columns with random values. i need to insert the 1st row of the first column with the highest number of the two rows in the first column and vice versa. some thing like this. I'm sorry If my question is unclear...:rolleyes:
input
col1 col2
12...11
11...14
34...45... (11 Replies)
Hi...
How does awk or sed or even grep extract the following string out of my text file?.
'"${ETL_VW_SCHEMA}"'.IATA_STN_TZ_UTC_LCL_CONV_CV
'"${ETL_VW_SCHEMA}"'.CO
'"${ETL_VW_SCHEMA}"'.TEST_CO
I just need to extract the second entry which means I need to let awk know I am just searching for... (5 Replies)
Could someone find out wht exactly is goin wrong in the following awk:
awk '/${EDW_DB_SCHEMA}.WRKR/ || !/otable/&&/${EDW_DB_SCHEMA}.WRKR/ || !/db-ter-load-data/&&/${EDW_DB_SCHEMA}.WRKR/' <my_graph>.ksh
Basically, I am trying to achieve:
Find out the occurence of WRKR table in <my_graph>.ksh... (3 Replies)
Hi friends,
I have a small problem with AWK. I am not able to print decimal values! :confused: below is my code:
#! /bin/awk -f
awk BEGIN{printf("%d",123)}; -> This prints the integer properly.
x=111
awk BEGIN{printf("%d",x)}; -> This doesnt print! :(
Please help me solve this. It... (4 Replies)