How to replace strings in the last n-lines of multiple files in linux
How can I replace strings in lets say 'last 10 lines' of multiple files?I have about 100 files with the same extension '.txt' and I would like to replace string 'GLN' to 'LOO' in the last 10 lines of...
View ArticleHow to check whether one number range from one file is the subset of other...
I'm trying to find out whether range1 numbers [both columns a and b] are the subset or lying between range2's columns [both columns b and c].range1 a b15 20 8 1037 4432 37range2 a b c chr1 6 12 chr2 13...
View ArticleUsing sed or awk to remove near-duplicates
I currently use the following to get as close as I can do to a filecut -d '' -f 3- /var/log/issues.log | sed -E 's/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}//g' | sort -uSo far it gets rid of the...
View ArticleReplace a text within single quotes with another string using sed(just a...
I have a file with the following content:$ cat file.txtCREATE COLLATION public.collation123 (provider = libc, locale = 'fr-FR'); CREATE COLLATION public.collation_1 (provider = libc, locale = 'bas');...
View ArticleUsing grep to "vlookup" values from one csv to another
I have 2 csv files -file1.csv with a list of 5 IDs in col A (col 1)file2.csv that has a table with multiple hundred rows and cols. One of the cols (col 8) matches the IDs in file1.csvI want to use this...
View ArticleRename multiple files with variable extensions to remove beginning and end of...
I have multiple files I need to rename as...
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 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 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 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 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 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 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 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 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 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 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 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 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 Article