Category "awk"

Regular expression to capture alphanumeric string only in shell

Trying to write the regex to capture the given alphanumeric values but its also capturing other numeric values. What should be the correct way to get the desire

AWK, 2 prints with different separators from the same file

Lets say I have this line "58062","2022-03-23 10:07:21.718670","Standard query 0x04c0 AAAA contoso.local" And I just want to print "contoso.local" which is the

Find lines in a file that has only words in a list

Here is file1.txt: .apple .ball .cow .apple .cow .tea .mine.nice .mine.nice .tea .zebra Here file2.txt .apple .mine.nice .cow .tea Expected Result: .apple .co

Retrieve all rows from 2 columns matching from 2 different files

I need to retrieve all rows from a file starting from some column matching from another file. My first file is: col1,col2,col3 1TF4,WP_110462952.1,AEV67733.1 1T

How to replace 00 with Na excluding first row & first column using bash in comma separated file

I'm working with GWAS data, My data looks like this: IID,kgp11004425,rs11274005,kgp183005,rs746410036,kgp7979600 1,00,AG,GT,AK,00 32,AG,GG,AA,00,AT 100,TT,AA,00

Capitalize specific indices of string using awk or python

I have an input file where each line contains 99 lowercase letters, bccdddcdccddddddabcdabcabdbacbdcaaccbbcabacbccabcacbcdcccbdbacdcbbcbcbcccacadaaccababadbcbaa

Append lines separated by comma while preserving the existing new line

Bash script used: #!/bin/bash set -xv IS=$'\n' list=$(cat exlist_sample | xargs -n1) for i in $list; do echo "$i" | rev > slist echo "$i" >> z

Append text in front of variable within the same line - bash

I have this example.text > cat example.text 10.10.44.11 10.10.44.20 xa1-Y xa2-Y xb1-Y xb2-Y xc1-Y xc2-Y xd1-Y xd2-Y and I have this command: srxa_host_list

How do I extract two different keywords from two different lines in a file in bash shell?

I have a file called data.txt. when I read the file, the content looks like the below. $ cat data.txt name: linuxVol id: 6 type: Linux dir excludes: .snapshot*

edit the ID column to add chr to a number

I have a vcf file. It looks like this: It has a vcf header followed by genotype information. I want to add chr to third column. Like now it looks like: 21 98257

How to I set a symbol inside the record separator of awk

How do I include symbols into the record separator of awk. I know the basic syntax like this: awk 'BEGIN{RS="[:.!]"}{if (tolower($0) ~ "$" ) print $0 }' which

GNU Make: expand pattern before passing to Shell

I want to use an awk script to figure out the which modules have to be compiled before I can compile a FORTRAN source file. My project is structured in a way th

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