I am trying to parse a log file with the following code:
If [[$ line-match "=====. *"]]]]; So awk $ 2 = $ vFiler; Repeat "$ vFiler";
Explanation:
The lines starting with a pattern such as =====
or 'vol / ...' are one Name will find all the lines that start with =====
or'vol / ... 'and set the string which is equal to one variable, but I actually I am thinking about an order with if awk (I know that -Mail is not real command).
The input looks like this:
===== vfiler0 / vol / vol0 Vfiler1 / vol / vol1
output Should be:
Can you help me? I am trying to do this in a bass script, as if I tried it above, "if ..." is possible to get it?
I will use the following:
awk -v RS = "=====" -V OFS = "," BEGIN {print} vFiler "," type "} NF {print $ 1, $ 2} 'file
:
vFiler, type vfiler0, / vol / vol0 vFiler1, / vol / vol1
We record the separator =====
. In this way, a block of ====
will be handled every time. Then, whenever there is at least one ( NF
), we print the first and second fields Are there.
Comments
Post a Comment