Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gawk]

gawk is the GNU implementation of awk. The awk utility interprets a special-purpose programming language that makes it possible to handle simple data-reformatting jobs with just a few lines of code.

0
votes
2answers
481 views

Find and replace dot with text in column1 using gawk or awk

I have a csv as follows 1.2kbps,link1,description 1.2mbps,link2,description I would like to Find and replace a)dot and kbps with 000 in column1 b)dot and mbps with 000000 in column1 using gawk ...
0
votes
2answers
51 views

Print N number of observations that are non-missing from specific column in delimited file

Say I have file.txt that is pipe-delimited, and I want to take a look at 10 non-missing observations from the 20th column to ensure they appear in the correct format. Would I use the awk command and ...
-1
votes
2answers
195 views

awk - replace pattern

how do I search the following pattern by awk in a file. '\b' The pattern is one of the lines in a file. I have to add text next to the pattern. Like this: '\b' TEXT Any of these commands are not ...
1
vote
1answer
72 views

Improve performance when using “system” call (shell escape) processing large files in awk

I have an awk script that processes very large files that look something like this: K1353 SF3987.7PD833391.4 KARE K1353 SF3987.2KD832231.4 MEAKE K1332 IF4987.7RP832231.2 LEAOS K1329 SF2787.7KD362619....
1
vote
1answer
110 views

socat and gawk piped

I'm trying to manipulate a TCP stream using gawk. The TCP server streams out a text string separated by whitespaces. I want to add an extra string at the beginning and then separate the remaining ...
1
vote
1answer
31 views

Using GAWK to sum certain numbers line by line

My lines will look as such X 2.63766751981802 Y 1.68326762144808 Z 0 XX 2.63577810877244 YY 1.67475013544567 ZZ 0 Using GNU awk, how do I print (X-XX) + (Y-YY) on the end of every line? Just to ...
1
vote
1answer
185 views

Gnu AWK split by pattern and insert columns , but get more delimiter

I have used same awk file to process two different string. So wired. cat test.awk BEGIN{FPAT="([^,])*|(\"[^\"]+\")";OFS=","}{$4="TDP,-1,-1,0,0"OFS$4;print $0} echo "a,b,b,b,b,b,b,b,b,b,b,b,\"a,b\"" ...
1
vote
1answer
159 views

Find matches from an index file without exact matching and print the last field

I have a large file (~6mill rows) with 2 columns which looks like this: 1111.aaaaabbb.b.cccc.c ValueA 2222.dddddeee.e.ffff.f ValueB 3333.gggghhhh.h.iiii.i ValueC I want to use that as my index ...
0
votes
1answer
26 views

modify between (only) 1st occurrence of patterns (inclusive of patterns) and keep processing

There are several questions about matching between only the first occurrence of two patterns (e.g., this) — but they all seem to rely on exit, which is no good, as I want to keep processing the file. ...
0
votes
1answer
84 views

gawk process multiple files inside directory

I have multiple text files in a folder that I want to process through gawk, rather than process them each individually is it possible I can process them all at once without merging them into 1 .txt ...
0
votes
1answer
38 views

two input files data processing

I have two huge input files: file1 contains 3 tabulator separated fields: field1: UID field2: username field3: Real Name Example of file1: 644 u11496 Real name1 640 u1309 Real name2 ...
0
votes
1answer
971 views

how to get multiple command output as variable in awk

I am trying to execute 3 command and get the output as a variable which needs some percentage calculation and display the same as the example. can this be executed as script. First command output $ ...
0
votes
1answer
591 views

Matching lines from one file to lines in another file

I have a rather big list(1million or so) and another huge list(17gb), I need to match the lines in list1 with the first part of a delimited file 2 as such: List1: 98433259@34 90345394@43 94335053@23 ...
0
votes
1answer
144 views

gawk on multiple files in bash

I am running this command in a command prompt gawk -f comparefirstandsecond.awk First.out Second.out I want to do it in bash shell script and I am trying it like: compareAwkOut=$(cat $...
0
votes
1answer
66 views

Unix file edit for pattern substitution

I have a file with repetitive patterns like below: set m [ meas new $proj rajesh ] meas $m set_type lvf_timing abcde erft 1213 234 456 897 00000000000000 once upon a time set t [ table new $m ...
0
votes
1answer
41 views

gawk columns from multiple files and add to a single text file

I have 50 sets of files containing 9 columns (sample shown in the attached picture). The files are named as ( 1) inputfile_1.assoc.logistic (2) inputfile_2.assoc.logistic etc…. The values in ...
-2
votes
1answer
115 views

ipvsadm output processing

I need to process ipvsadm output which is similiar to this: IP Virtual Server version 0.2.12 (size=16384) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ...
1
vote
0answers
431 views

strings concatenation on variable

how to collect add do existing "b" values next matching? input: 1:2:3:4:5 6:7:8:9:0 1:3:2:4:5 $ echo -e "1:2:3:4:5\n6:7:8:9:0\n1:3:2:4:5"|awk -F: '$1=="1"{b="line "NR" "$2;print b}' line 1 2 line 3 ...
1
vote
0answers
602 views

How to speed up awk script that uses several large gzip files?

I have two data files: file_1.in, containing over 2k lines like "12 AB0001": 10 AB0001 11 AC0002 12 AD0003 ... A list of *.gz gzipped files (about 1 to 3 million lines) I should extract and parse ...
1
vote
0answers
185 views

How do split and patsplit work?

From Gawk's manual patsplit(string, array, fieldpat, seps) Divide string into pieces defined by fieldpat and store the pieces in array and the separator strings in the seps array. Is it ...