AWK with RS not matching a pattern (asking again because I accidentally...
I have an ODT file with blank lines between lines of text. I want to search for a term and output the whole group of text where there is a match to the term. My approach is to say that the blank lines...
View ArticleTrying to use awk to add a column with current filename in TSV files
What I'm trying to do is to loop through all of the tsv files in a directory, adding a column to each, that column consisting of the current filename in the loop. I have this code and it does what I...
View ArticleWhat does this command do? XML_FILE=$(awk -F: '$1 ~ /^XML$/{ printf("%s",$2)...
I’m working on a Bash automation script, and I came across this line:res_file=./tmp/VM_Win7/baseline/VM_Win7_ML-14.7.19-1XML_FILE=$(awk -F: '$1 ~ /^XML$/{ printf("%s",$2) }'"${res_file}")The goal is to...
View Articleremove commas in double quotes
I have a comma separated line for example below that I am using awk to extract fields from. However, when it comes to the text in double quotes ("Blue, Green"):Server1,poweredOn,10.0.18.70,"Blue,...
View ArticleHow to extract a table from links dump?
The following is a links -dump of which I want to extract the table with all the columns in all the file... I tried using awk but failed * Home * Frontpage * Continents * Africa * The Americas * Asia *...
View ArticleConvert a string of characters to ascii values
I have been searching through the internet on how to do this but have failed to find a way to actually do it..Basically, I have a series of large dataframes, and I wish to convert one of the column...
View ArticleCombine two files and aggregate another column
I'm trying to compare two files, on basis of the id column,A.txt contains ID, NAME fields.B.csv contains ID, NAME, PLACE, DATE,I want find which month had most of the ID's from a.txtI'm trying to do...
View ArticleReplace XML tags by numbers
Suppose i have an xml like this<a> hey how are</a><a> where are you</a>I want to change them and assign number like this--1.hey how are2.where are youI would prefer the answer...
View Articleunable to store output of awk command
I am trying to print git clone progress in a minimalistic way for my project.AimInstead of printing a whole git clone output on screenremote: Enumerating objects: 1845678, done. remote: Counting...
View ArticleWhat is a practical way to list every character used in a file (Bash) (Regex)
How can I turn this:Johnny's penguin, (Tuxie), likes the following foods: French fries, and beef.To this: abcdefghiklnoprstuwFJT',():.(These are the total characters used in the input)Please note that...
View ArticleAWK issue on Bash script
I need to shortlist the logs between the particular timestamps.I can achieve it by using the below command.awk '$a>="Feb 5 10:44:*" && $a<="Feb 5 10:54*"' /var/log/xxxxBut it's not...
View ArticleWhat does this command mean: `echo $line | awk -F "\t"'{print $1;}'`?
I'm new to this, and I was wondering specifically what awk -F "\t" means.
View ArticleCouldn't able to store a output of awk command
I have been trying to print git clone progress on more minimalistic way for my project.AimInstead of printing a whole git clone output on screenremote: Enumerating objects: 1845678, done. remote:...
View Article--- Article Not Found! ---
*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***
View Article--- Article Not Found! ---
*** *** *** RSSing Note: Article is missing! We don't know where we put it!!. *** ***
View ArticleHow can I capitalise a word proceeding a specific word
Lets say I want to capitalise the first word following the word jumped. Example belowOriginal text:the cow jumped over the moonAmended textthe cow jumped OVER the moonI have tried awk and sed but cant...
View ArticleDelete all lines from a line with certain string until another line with a...
file.txt:start some text works "HELLO" foo test sum otherendstart som "other" line with text 'also' thing fooendand I want to delete the line in which "HELLO" is located and then delete all following...
View ArticleHow to get the average ping time?
Here's a real result of my ping 192.168.1.1 command:64 bytes from 192.168.1.1: icmp_seq=964 ttl=64 time=1018 ms64 bytes from 192.168.1.1: icmp_seq=965 ttl=64 time=921 ms64 bytes from 192.168.1.1:...
View ArticleChange the cURL response encoding for some characters
The response of the below curl command is a json and it has some japanese characters which it is showing in utf-8. I can't share the url but this is how I am sending the request.curl https://some-url...
View ArticleHow to sum the values in multiple text files?
In Ubuntu desktop 20.04, I have 20 directories, each containing a text file with the same name, "weights". These text files contain ~20-30 numbers separated with a space. In each of the 20 directories,...
View Article