Questions tagged [gawk]

gawk (short for GNU awk) is a free implementation of awk with manifold useful extensions.

gawk (short for GNU awk) is a free implementation of awk with manifold useful extensions.

AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool. It is a standard feature of most Unix-like operating systems.

Source: Wikipedia

See also .

Reference

981 questions
-1
votes
1 answer

AWK - Calling multiple arrays

Right so I have and input file which has a multitude of rows but I am only interested in $11 and $12. these fields look like the following: $11 7.4ms 8.5ms …
glly
  • 107
  • 7
-1
votes
2 answers

How to match to a shell variable in awk?

I am trying to match a shell variable with the second column separated by commas. So I've set $INOW to ls and the command looks like this awk -F"," '$2 == $INOW {print "yeah it's there"}' commands.csv I have tried putting quotes around $INOW. no…
Hrishikesh
  • 335
  • 1
  • 13
-1
votes
2 answers

awk/gawk seems to overwrite columns on result

[TRIVIAL] [SOLVED] tl:dr - DOW CRLF made to feel as though awk misbehaved; trivial mistake! Am not sure why awk/gawk is behaving this way. Any hints? Ever seen awk results overwriting the columns on terminal? I am seeing this on just one machine;…
raghava
  • 236
  • 4
  • 12
-1
votes
1 answer

Show IP Address and IP Address Count Per Hour from Apache Logs

How do I use awk to parse the Apache access log file to display information in the following format? Date Time Count IP Address 2016-05-26 00:00 200 192.168.1.x 2016-05-26 00:00 152 172.17.100.x 2016-05-26 00:01 43 …
dqfan2012
  • 21
  • 1
  • 2
-1
votes
3 answers

How to join 3 patterns as a line with awk

Im got text similar to this one in a file. OVM> show PhysicalDisk id='12346579123456789123456789' Data: Page83 ID = OVM_SYS_REPO_PART_12346579123456789123456789 Server Reserved = No Shareable = No Size (GiB) = 503.37 State = UNKNOWN Thin…
Nocturn
  • 321
  • 6
  • 13
-1
votes
1 answer

how can I read time in miliseconds twice in gawk

Gawk trying to get time in milisec start and end of program. 1st "echo %time%" | getline startT, works like a charm. 2nd "echo %time%" | getline stopT, yeilds NADA. for some reason the second %time% does not work. ......any ideas? Thanks, Joe
joseph T
  • 1
  • 1
-1
votes
2 answers

Get only part of a file name in Awk

I have tried awk '{print FILENAME}' And the result was full path of the file. I want to get only the file name, example: from "test/testing.test.txt" I just want to get "testing" without ".test.txt".
Bams
  • 31
  • 4
-1
votes
1 answer

How can I print a particular list of text using gawk/grep ? for example I would like to print the names of all the colors present in txt file

Just started learning Linux. Getting my hands dirty with grep and gawk. Suppose I want to print all the available names in .txt file or for example I have text file that goes; "blah blah blah blah blah blah bhah blah blah…
-1
votes
3 answers

grab the 3rd to the last column

I am trying to grab the 3rd to the last column in the "df -m" command but it does not seem to work. Well its works on one and does not work on other. Part of the reason is for one mount point we are using LVM and other we are using standard linux…
max scalf
  • 329
  • 1
  • 8
  • 19
-1
votes
1 answer

issue with awk and variables from previous line

Code typically speaks better than thousand bytes. So did this demo code that does not obey my logic. Typically I trust compilers and programs, so I think I have a typo or something somewhere. Please, could you point it out to me? copy & paste code…
-1
votes
1 answer

awk pattern from external txt file

Currently I have a folder with 4 files, one script.awk script file, the gawk.exe binary which runs the script and a report.csv file in which the script reading the lines from, and one names.txt file which contains usernames, one per line. Sometimes…
sasieightynine
  • 434
  • 1
  • 5
  • 16
-1
votes
1 answer

Need Algorithm to create a auto code from a CSV file

I have "N" columns in a csv file say Hardware,Sensors,Statistics(1,2,3 .....N) as shown below. Each column has unique xml code that I need to generate with respect to the above table content.
034568
  • 33
  • 8
-1
votes
1 answer

awk to compare two file by identifier & output in a specific format

I have 2 large files i need to compare all pipe delimited file 1 a||d||f||a 1||2||3||4 file 2 a||d||f||a 1||1||3||4 1||2||r||f Now I want to compare the files & print accordingly such as if any update found in file 2 will be printed as…
bongboy
  • 147
  • 1
  • 15
-1
votes
1 answer

Is there a way to print a regexp match with AWK?

I want to check that particular string "20040213_25049.XXXX" containing XXXX or not on other hand when do I write string like "20040213_25049 .XXXX" then it is matched but I want to match with "20040213_25049.XXXX" echo "20040213_25049 .XXXX" | awk…
user2932003
  • 171
  • 2
  • 4
  • 14
-1
votes
1 answer

Printing the compared result under last column header

I'm doing a comparision of 2 files file1,file2 using first column in file1 to first column in file2 and retriving corresponding value from 7 th column . awk -F, 'FNR==NR{a[$1]=$7;next} {print (($1 in a) ? $0","a[$1] : $0",NA");}' file2.txt file1.txt…
XYZ
  • 47
  • 5