Stay at Home!! Be Safe!! Take Care!!

Thanks all my viewers for your support, I am an Oracle Ace now. For Any queries, please mail us at support@funoracleapps.com

LINUX AWK Tutorial Series | Chapter 2

No comments

LINUX AWK Tutorial Series | Chapter 2

Hello Everyone, now in this chapter I am going to share the keywords and topics covered in the series of AWK. Let's learn some basic concepts which will be used a lot in this tutorial series.
AWK itself is like a full processing language and uses almost most of the concepts of any similar programming languages.


Important topics which would be covered in this series:

Delimiter: It is used to separate fields in AWK. By default delimiter for a file in AWK is space or white space, but we can use any other delimiter as well for separating the fields and processing based on the same. In simple words, we can say it helps in separating two words.

Variables :
Variables can be of the following types:

1) User Defined: It is defined by the user in AWK.
2) Built-in Variables: They are predefined in AWK and should not be used as user-defined variables
Example: RS, FS,ORS,OFS,NR,NF,ARGV, ARGC

Conditional Statements:
How to check specific conditions in AWK using

  • if
  • else
  • else if
Loops:

Loops help to rerun certain statements until specific conditions are met.

  • for
  • while
  • do-while
Search Pattern: Match specific patterns and process based on the same using single or multiple files.

Arrays: How we use arrays in AWK. Single and Multi-Dimensional Arrays

Functions: It can be a built-in Function which is already present in AWK or user-defined functions(we will create them)

Built-In Functions Examples
Arithmetic,Random,String, Input-Output,Timestamp

OS Used: I am using Linux 7(RHEL/Centos/OEL). These will work on Debian based systems as well.

Sample File used for example

If you want to practice, Please save the file in your respective directory. If I will use any other files going forward, that will also be shared.

Employee_Data.csv

Bob,M,Human Resources,30000
Alice,F,Human Resources,45000
Mark,M,Human Resources,30000
Robin,M,Human Resources,20000
Maria,F,Human Resources,30000
Kevin,M,Human Resources,60000
Robert,M,Human Resources,420000



The next part in the series will continue..


If you like please follow and comment

No comments :

Post a Comment