This blog is the continuation of my previous blog , where I have explained the difference between PowerShell and Shell Scripting through 5 different scenarios. Here , in this Blog , I will take few more commands and will show the difference between them. Consider one file in windows and one file in Linux with same Data. Print selected column of a fileWindows use below commands. Need to mention what all columns are required.$headers=@(“COL1″”COL2”) Use import csv command to display data for above mentioned headers.Import-Csv -Path .\PowerShell_Scripting.txt -Delimiter ‘|’ |…
Tag: AWK command
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…