Examples of Awk Command

In this blog, I will explain various situations where you can use AWK command.Scenario 1: Identify the occurrence of a particular delimiter present in a variable.For example , consider a variable v_dem=”v1|100|v2|200|v3|300″Use Awk command , you can easily find the occurrence of Pipe delimiter in v_dem variable. Here, NF stands for Number of fields . LINUX COMMAND : echo $v_dem |awk -F ‘|’ ‘{print NF} ‘ Scenario 2: Print the values separated by Delimiter(Pipe in this case) using AWK command.LINUX COMMAND : echo $v_dem | awk -F “|” ‘ {for…

Check existence and non-existence of columns in a table

In this Bog, We will prepare a query which will tell us which tables has one specific column but another column which is also important is not present.QUERY-1select distinct TABLE_NAME from INFORMATION_SCHEMA.COLUMNS c where COLUMN_NAME=’column1′ and not exists ( select 1 from INFORMATION_SCHEMA.columns cc where cc.TABLE_NAME=c.TABLE_NAMEand cc.COLUMN_NAME=’column2′) The above Query will list all tables in which column1 is present and column2 is not present. QUERY-2select distinct TABLE_NAME from INFORMATION_SCHEMA.COLUMNS c where COLUMN_NAME=’column1′ and exists ( select 1 from INFORMATION_SCHEMA.columns cc where cc.TABLE_NAME=c.TABLE_NAMEand cc.COLUMN_NAME=’column2′) This Query will list all tables in…

get all Values separated by delimiter in sql

In this blog, I will discuss about “How to get all values separated by delimiter in SQL”. In one of my previous blog, where I have explained about positions of all delimiters present in a string. We will use same logic here as well. For example I have string with value abc@gmail.com;xyz@gmail.com;123@gmail,comIn the above string, I have three email ids which are separated by delimiter ; . I need these values in below format abc@gmail.comxyz@gmail.com123@gmail,com Use the below code to fetch the data in above format . declare @var1 varchar(100)…

Delete data from Access Database in Pentaho

In this Blog, I am going to discuss about “How to delete data from Access Database using Pentaho ETL tool”. In order to understand how to setup Access Database connection in Pentaho, you can use this link for the same.In order to delete data from Access table, consider a table Table1 in a Access Database (Access_Sample_DB.accdb) having two rows . Follow below steps in order to delete record from Table1 Access table.Open Pentaho workspace using spoon.batOpen New TransformationCreate Access Database Connection as per the above link.Drag Execute SQL Script component.Run…

select Query using Access database in Pentaho

In this Blog, I will discuss about ” How to Query the access database tables in Pentaho”. In my previous blog, where I have explained how to create Access database connection in Pentaho. Please go through this blog to have better understanding on Access database in Pentaho. I created one sample table(Table1) in Access database(Access_Sample_DB.accdb) and inserted two records. See the below SS. Open Pentaho using spoon.bat . Open New Transformation and drag “Table Input” Component and select the Access Database Connection. Write the simple select Query to fetch records…

Create Access Database Connection In Pentaho

In this Blog, I will discuss about “how to establish Access Database Connection in Pentaho”. In order to achieve this, Please follow the below steps.STEP-1 : Create Access Database in your local Machine. Go to Access->Blank Database . Give an appropriate name to the database. See the below SS for the same. Once you click on Create Button, Accesss_Sample_DB.accdb will be created. NOTE : You need to have a minimum one table in Access database. STEP-2: Download the access database JDBC Drivers from the below location. Unzip the file and…

Pure Virtual function-Abstract class

Let us try to understand pure virtual function with the help of an example. #include <iostream>using namespace std;class shape {public:    virtual void calculateArea() {}};class rectangle: public shape {public:    void calculateArea() {        cout << “Rectangle Area calculation” << endl;    }}; In the above example, calculateArea function is overridden in rectangle class. In shape class, definition is empty since shape class does not know what to calculate. Can we say that empty definition of calculateArea function in shape class is not required. Instead, anyone who inherit shape class must redefine or override…

PULL COMMAND TO UPDATE MASTER IN VISUAL STUDIO

In this Blog, we will discuss about “How to update your Master Branch in visual studio”. This can be accomplished using pull command. Before that, we need to understand why we need to update the local Master branch to that of remote Master branch which is git Repo. In a project, multiple people works on the same module and hence we need to update local Master branch so that all changes which are done by developers are updated in your local Master branch . Therefore, when you check-in your changes…

PUSH LOCAL CHANGES IN VISUAL STUDIO TO GIT

In this Blog, we will do some changes in the “test” Branch (which we have shown in my previous blog “Create local branch in VS“) and push those changes to git Repository. Suppose you have done some changes in the code developed using Visual Sudio . Here, I am changing one file(README.txt). Below is the content of the file before and after changes. As soon you save the changes , you will see that changes in “Git Changes” Section. Now, you need to select those files , Right click and…

CREATE LOCAL BRANCH IN VISUAL STUDIO

In this Blog, I am going to explain about “How to create a new branch in VS and how you can push that branch in visual studio to git. In my previous Blog, I have mentioned about Cloning the repository in visual studio. You can see that Blog as well. Below are the steps needs to be followed in order to create New Branch and push that Branch to git .1. Open the VS and Login with your credentials.2. Go to Master branch(Assuming Clone Repo is already Done).Below is the…