If statement in Org is pretty simple.
We are using key vote if followed by condition enclosed in parentheses.
So if that condition is true we are executing commands inside curly braces.
If that condition is not true on inside our section are performed.
The question is how to write conditions in awk.
For example if you want to ask if a value of variable or wire is equal to 5 we need to use double equal
sign and if we for example want to ask a value of variable var is less than 5.
If you just use less than symbol Let's start with looking at our file called table and let's say that
you want to display only a line where the name is equal to Jane and you want to do that using IF statement.
So in the main awk section we ask if value of first field is equal to J.
So if
dollar sign is equal to Jane
and if this condition is true we can print or record all line
and date all line is represented by our Sanzio
and we see the output get.
It is better if use for a body of IF statement curly braces.
It is not needed when you have only one command inside as we have print door Sanzio.
But when you have more commands don't forget to use them.
Now let's say that we want to display from Basford file name and shell for specific user.
For example we found that for use in a root so pass passport file as an input into awk program.
Then we want then we need to change fields separator to com so we can put in specific fields as name
and Chell and then in the main org section we will ask using IF statement.
If first field is equal to route
and if it is equal we can display first field which is name
so print dollar sign one and we can also bring 7 field which is shell and Vissi output.
Been Abeche great but for being sure just check this information using grep command soul got password
file and use grep root and we see that the root shell is truly been Abeche great
we can now project is Else statement.
So at Alice statement after curly braces off if statement
and I'd say that if first field is not equal to the old we will display only first field and not 7 field
so print dollar sign one and we see that it is working perfectly only reward has displayed information
about show great.