Sed, extract lines from text
I really would like to know how can I extrac some line from a text file using sed, but I'd like to extract the lines at interval:For example extract the line with number i=1:2:100So that i can extrac...
View Articlewhy is my output not correct while dividing by a variable in awk?
I wrote a little watch script to watch the load avarage on a Linux server (just for learning purposes and because watch uptime isn't giving the output I want).It works great, but to have the load...
View ArticleHow to separate 2 variables in awk print with echo?
I did a small test to echo everything in my .txt named portal.When writing in terminal I want the script to echo all with the name entered but I only show the first variable.input=$1 for portal in...
View ArticleGrep from nginx server files, but exclude www.domain.tld
I have a command in a bash script like this, to get me an array of all the domains on my webserver.domains=($(grep -rnw '/etc/nginx/sites-available/' -e 'server_name' -l | xargs grep -e 'server_name' |...
View ArticleHow to align the text file after copy and paste?
I copied column 7,8 and 9 from file 1 into columns 7,8 and 9 in file 2 producing a new file 3. the produced file (file 3) is not aligned as the original files, How can I edit it to preserve the...
View Articleusing awk to find special charecters in txt file
I need to scan a file with many different special charecters and values.Given a set of special charecters - I need to provide the value next to it:547 %$ 236 \"4523 &* 8876 (*8756 "/...I am using...
View ArticleSeparating Commands in a Script File?
I have an assignment running a series of (n)awk commands in one script file. The key of this script file is to filter out certain lines and records of this original text file here, called students:...
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 ArticleRename multiple files with variable extensions to remove beginning and end of...
I have multiple files I need to rename as...
View ArticleWhy does this awk script that runs on CentOS not run on Ubuntu?
(for reference, the code is likely also here:https://github.com/garyexplains/exampleswhich is probably a better source than a video.)Would there be any reason why this simple script on CentOS wouldn't...
View ArticleKeep original spacing while doing replacements [AWK, SED, GREP, ...]
I have two files which content are:File 1:ATOM 1 N LEU 1 -10.186 -21.276 -0.497 1.00 0.00 PROTATOM 2 HT1 LEU 1 -10.773 -22.005 -0.843 1.00 0.00 PROTATOM 3 HT2 LEU 1 -9.316 -21.441 -0.958 1.00 0.00...
View Articleawk adding up two rows if the rows have a matching name
I am trying to take a csv file that looks likecustomerID,firstname,lastname,charge5efc522,Romo,goodrick,37.894a7f057,jeny,vel,38.395efc522,Romo,goodrick,39.00and make it...
View ArticleGet human readable cpu frequency
I am trying to get a simplified output of the cpu frequency to 3 digits, such that if the frequency is less than 1000 it will output xxx Mhz and if it's above 1000 it will outpute x.xx Ghz. I can get...
View ArticleHow to search an XML file and print text of a certain color
I have tried grep, awk, sed and am starting to try xmlstarlet but I'm not finding much support with that.I'm guessing the xmlstarlet is telling me that the XML is ill formed, but all I want to do is...
View ArticleAWK: How to delete last pattern?
I have a path:/home/alejo/Desktop/Proyecto_UIS-MINCIENCIAS/qmmm_propranolol_aescorcia/A_PSF-NUEVO/ORIII/MCC/out/mcc_oriii_after_centering.pdbI want to...
View ArticleIs there any online awk command "explainer"?
First, I am not sure where I should ask this question. Please point me out the correct forum if this place is not meant for this.I am looking for a tool that can explain awk commands.As a reference,...
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 ArticleAWK with RS not matching a pattern (asking again becuase I accidently labled...
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 ArticleUsing awk for a bash script that defines a "minimum packages set"
I would like to write a script with the following requirements:in input, get a list of packages available via apt. In there you may have some packages that are automatically installed by other packages...
View Article