I have tried using awk and cut, but the position of these values keep changing, so I wasn't able to get the required output using awk and split it into columns.
The value before the ":' is always constant, the value in the brackets only keep changing.
I need an option which prints in the following manner based on what is being grepped.
it should be a one liner as it is part of a much bigger script, and it should be able to compare the value in the brackets for "xyz:" and "abz:" and if it is the samee then it should print "qrt: [2312]"
In the above example lines the output should be only "qrt: [2312]" as that is the only line with the matching value in the bracket of "xyz:" and "abz:".
I need a one liner because it is part of a bigger script as I have mentioned. I am not sure what do you mean by homework. I am writing this script to gather a lot of different variables, and this is just one of the variable.
A solution and the number of lines in the code is also equally important to me as I will be filtering a lot of other parameters before i come to this part of comparison, and also do a lot more filtering and calculation.
Earlier when the position of the variables in the log files weren't changing so i used to use a simple awk comparison like below,
awk '$2!=$5{print $9}'
I am not an expert in awk, so I am asking help on this.
And finally sorry for starting another thread, I wasn't sure if it has to be one question in each thread, so I started a new one.
Most of the time, I search and try for solutions from the existing threads, but i couldn't find anything close to my problem and I really need some help in getting this solution.