Category "awk"

Awk if else with conditions

I am trying to make a script (and a loop) to extract matching lines to print them into a new file. There are 2 conditions: 1st is that I need to print the value

To replace a immediate text after pattern match in Linux shell using sed

Content of a json file "iso_checksum": "md5:32fdf4fef4ef" I have stored value of new checksum in a variable v = "4dfv45ffdf" I want to replace the value after

How do I get only names of active plugins in Wordpress?

I am trying to to get list of active Wordpress plugins and for that I am using wp plugin list --status=active --allow-root command. That gives me putout like t

Process swap usage with use ID

I've been trying to get a one liner working updated to add the user name for the processes consuming swap on the system but having a hard time getting it to wor

Capture nth field bash

I have data in a file test.txt in below format. abc,123,mno,xyz,1234 mno,123,abc,rpt,pqr,2345 xyz,456,uyt,rtp,rto, I want to capture the 3rd field which I am a

bash output with extra newline within the string

I use the following command to output PID and FD related to CLOSE-WAIT sockets. sudo ss -p | grep CLOSE-WAIT | awk '{ print $7 }' | sed 's/,pid=/ /' | sed 's/,f

Fastest way to chunk and calculate sum, min, max in a 70 GB csv file

I have a 70 GB csv file (data.csv) that has the following structure Timestamp,Price,Volume. 1649289600174,100,100 1649289600176,105,100 1649289600178,109,100 16

Awk help required

I wrote the below script to check expiry age of users on psql #!/bin/bash echo "" echo "Performing User Expiry Check" echo "" CONTAINER_ID=$(docker p

Sort according to two columns and extract top two based on last column

I have a file with three columns. I would like to extract rows with top two values in column 3 for each unique value in column 2. cat file.list run1/xx2/x2c1.tx

How to generate string with a char repeated for n times?

I can use the following code to generate a string. $ awk -e 'BEGIN { for(i=1;i<=10;++i) s = s "x"; print s }' xxxxxxxxxx But its complexity is super-linear

take difference between 2nd column values using awk

I have a data file, let's call it fileA. It has two columns and I want to take difference of 2nd column and multiply the output with 13.6 and write it down in 3

replace the header line of several sequences in a fasta file and replace them with the species names stored in a list (.txt)

I have a fasta file with several sequences, but the first line of all the sequences start with the same string (ABI) and I want to change and replace it with th

If else script in bash using grep and awk

I am trying to make a script to check if the value snp (column $4 of the test file) is present in another file (map file). If so, print the value snp and the va

GAWK script- Skip rows $6 OR $7 if = "" and STD calculation

I have put togheter in an awk script, the average and standard deviation from 2 columns (weight,height) and the % of olympic medals achieved (sum and group by m

escape single quote awk command in jenkins pipeline

I get error "awk: fatal: cannot open file `print' for reading (No such file or directory)" when executing this command in jenkins pipeline. sh """ssh -o StrictH

batch rename matching files using 1st field to replace and 2nd as search criteria

I have a very large selection of files eg. foo_de.vtt, foo_en.vtt, foo_es.vtt, foo_fr.vtt, foo_pt.vtt, baa_de.vtt, baa_en.vtt, baa_es.vtt, baa_fr.vtt, baa_pt.vt

Output of awk in color

I am trying to set up polybar on my newly-installed Arch system. I know very little bash scripting. I am just getting started. If this is not an appropriate que

Grep exclude count of occurence match between comments <!-- --> of curl body

I am very new to linux & bash script. I'm trying to read an xml file using curl command and count the number of occurrence of the word </entity> in it

How to not remove but only print multiply rows from CSV file using a awk?

i have the following code awk -F, '{key=$1 FS $2 FS $3} NR==FNR{a[key]; next} !(key in a)' dubl.txt original.txt which checking for duplicates in multiply colu

Parse Text with "awk" and Modify One Of The Columns With "sed"

I have a data seperated with pipe "|" and I would like to parse it with awk and write it into a DB. EndpointRequest|ID-ip-172-31-70-119-eu-west-1-compute-intern