Compare the two column strings and 2nd column string count should match with...
File110/22/2020 LDYA LDYA-PLSP10/22/2020 LDYA LDYC-PLSP10/18/2020 LBQD LBQD-PLSP10/18/2020 LDMN LDMN-PLSP10/18/2020 LDMN LLMA-PLSP10/18/2020 LDMN LDMN-DLV510/18/2020 LKNC LKNC-PLSPFile2KLS3 LDYA...
View Articleawk NR variable not working as expected, getting the whole line while asking...
echo cat:cat Records.txtecho ""echo Using a digit for the second record:record_id=$(awk 'NR==2{print $1; exit}' Records.txt)echo $record_idecho ""a=2echo a is set to $aecho ""echo Using a variable and...
View Articleif specifc line contains substring then output another substring
I want to look for a string on every line of a file and if it exists, return a different specific string.I have this code:Numlines=$(grep "" -c File.txt)for (( line=1; line<=$Numlines; line++ )) ;...
View ArticleHow to rearrange text file via awk?
I wanna print field (from 4th to the last field) as new line for each by inserting increasing arithmetically variable (from 5 to 25) after 3rd field in the text file.Data format:01.01.1995 01:00 1.0...
View ArticleConvert HTML to text format
I want to extract the page content from this HTML file:<BR /><TABLE style=border-color:#32506d border=1 cellspacing=0><caption class=header...
View ArticleEditing wc -l src Output
I am new to the Topic and working on a few bash commands.I am stuck at a task where i Need t ouput my result in a specific Format.wc -l folder/*The Output gives me:0 folder/file13 folder/file23 totalI...
View ArticleHow to add new columns to CSVs with the same text in all lines
This a sample of my input file:22/12/1999,conductivity,42,uS/cm06/01/2000,conductivity,22,uS/cm26/01/2000,conductivity,26,uS/cm09/02/2000,conductivity,32,uS/cm23/02/2000,conductivity,33,uS/cmI would...
View ArticleHow to use awk to edit a specifc line set by a variable (awk NR, -i inplace...
If file is:this is line onethis is line twothis is line threeI want to do something like:awk -i inplace -v line_number=$line_number 'NR == line_number {print $1}' file Lets say line_number=1. Then...
View Articleawk parameter substitution fails
I am on Ubuntu 20.04 Mate Desktop environment.I encounter a strange failure when I attempt to pass the date string to regex query in the following line : date="2020-12-11" cat /var/log/dpkg.log | awk '...
View ArticleAwk/Sed commands find and replace pattern
I have a file with data like the following. xyz can be anything, so I want to replace it.variable "azure_spoke_gateways" { default = { spoke1 = { name = "xyz" size = "max" vpc = "azure_spoke1_vnet" },...
View ArticlePass a variable in awk command
spke="myvaribale" var="cidr" val=$azure_spoke2_vnet_cidr clp="azure_vnets"I am placing these variable in this command : I dont want to write this myvaribale in awk rather I want to use $spke variable...
View Articlebash to find each time occurrence in text file, then replace with increased...
i need to find each time occurrence in text file,then replace each occurrencewith increased (or decreased) time.Example 01i have the following "file_01.txt"i need to "add" for example 00:01:02,999(zero...
View Articleawk -v var=$var /var/ is not working as expected
Portion of file:<style:style style:name="P15" style:family="paragraph" style:parent-style-name="Table_20_Contents"><style:paragraph-properties fo:text-align="center"...
View Articlewhat NF stands for in awk?
I know NF is the last element, as explained here:NF is a predefined variable whose value is the number of fields in the current record. awk automatically updates the value of NF each time it reads a...
View ArticleExtract the content from a file between two match patterns (Extract only HTML...
I have file which contains different kind of text formats, my goal is to extract only HTML part and create a file with this HTML code. I think it is possible with grep or awk. My file contains also...
View ArticleI want to search with RETCODE & find 5 lines above beginning with NE : . Is...
**NE : TALS1_TO**Report : +++ TALS1_TO 2021-01-25 02:02:18O&M #806356831%%/*1884960535 MML Session=1611550934*/MOD...
View ArticleExtracting name between two delimiters via awk
I have a string like this<user>@<server>:<port>:/foo/barand I would like to extract the user, server, port and directory.The user can easily be extracted byecho <string> | awk...
View Articlehow to split a string from a column using awk
I am a noob in Linux. I have a file like this: col1 col2 col3 ID1234567-DNA_A01 chr1_10203040_T/C gene 0 ID1234568-DNA_A02 chr1_10203050_T/A gene 0 ID1234569-DNA_A03 chr1_10203060_A/G gene 0...
View Articlewhy is my output not correct while dividing by a variable in awk?
I wrote a small watch script to monitor the load average on a Linux server (just for learning purposes but watch uptime wasn't giving the output I want).It works well, but to get the load average for...
View ArticleHow to convert gjf format to xyz format?
The gjf format is as follows:%chk=test.chk# hf/3-21g geom=connectivityTitle Card Required0 1 C 0.53424883 1.46721985 -0.02620215 H 0.89090326 0.45840985 -0.02620215 H 0.89092167 1.97161804 0.84744935 H...
View Article