Category "awk"

Print all lines between line containing a string and first blank line, starting with the line containing that string

I've tried awk: awk -v RS="zuzu_mumu" '{print RS $0}' input_file > output_file The obtained file is the exact input_file but now the first line in file is z

Save modifications in place with awk

I am learning awk and I would like to know if there is an option to write changes to file, similar to sed where I would use -i option to save modifications to a

How to shift a specific cell left in a text file

I have a very large text file (tab-delimited, first line is header) like this: A1 A2 A3 A4 A5 A6 A7 FA1 AB 234 231 0.02 456 I FA2 ACE 241 2154

How to extract only specific strings from each line of a file using awk?

I was wondering if there a generic way to extract a specific string which by design is an eleven characters alphanumeric string using awk approach? for ex- cat

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