Skip to main content

Questions tagged [awk]

AWK is a text-processing language. It is mainly used to manipulate and process structured data, and to generate reports.

2 votes
2 answers
228 views

Please note that I have done some search and tried different solutions with sed/awk and nothing worked. I'm stuck, so I posted the question here requesting your help. Let’s say that there's a generic ...
Charles's user avatar
  • 21
3 votes
4 answers
371 views

I’m trying to get the time delta value for a given host (I have either its hostname or IP address) from the following text: -------------------------------------------------------------- CentMgmt::...
breversa's user avatar
  • 219
4 votes
6 answers
1k views

There are lots of SE posts about replacing multiple spaces with a single space, but seemingly none about replacing one space with multiple spaces. Input data: $ head -n20 $X | paste -sd' \n' ...
RonJohn's user avatar
  • 467
2 votes
2 answers
189 views

I am new to Bash and wanted some help. I have a command which produces four lines and I would like these lines to be fed to four variables, so i can use them in the next command. could someone please ...
Swetank Jackson's user avatar
0 votes
4 answers
161 views

Say I have two patterns (pattern 1 and pattern 2) Want to print all lines matching the pattern 1 and print only line with pattern 2 which is the line before line containing pattern 1: eg: I have a ...
Bbabu's user avatar
  • 11
3 votes
3 answers
313 views

I'm using the following command combination to print value from an XML file to another file: grep -Po '<add key="WorkstationID" value="\K[^"]+' web.config.txt | awk '{print &...
Mario's user avatar
  • 33
3 votes
1 answer
646 views

I am testing this on a pretty old Debian 10 system using GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2) in GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) Both awk and gawk commands ...
Zsar's user avatar
  • 699
2 votes
4 answers
564 views

Consider a text-input that looks like this: a b pattern c pattern d e pattern a -- pattern z I would like to get only the lines that precede a match. E.g. if my pattern is pattern, the output should ...
umläute's user avatar
  • 533
-2 votes
2 answers
109 views

so i am trying to monitor how much bandwidth get used by transmission while torrenting. I searched and find an utility nethogs.if i run sudo netogs -t | grep transmission-gtk i get transmission-gtk/...
Sartaj Ansari's user avatar
0 votes
2 answers
149 views

Attempting to format tcpdump.txt file: Lines containing date, interface, protocol, etc. Lines containing network source device.port, destination device.port, flags, etc. Extra lines (discard) Input: ...
Danny Veals's user avatar
1 vote
1 answer
271 views

I'm working on a project to extract network info from tcpdump that requires many awk pipe commands for formatting prior to import into a database used for reporting, i.e.,: tcpdump -tttt -vi any -c ...
Danny Veals's user avatar
2 votes
2 answers
261 views

My goal is to use awk to parse tcpdump cvs file to extract network tracking and reporting information from columns #22 and #23 (columns and sample data) below: 1,2,3,4,5,6,,....,,22,23,,... 20-09-24,...
Danny Veals's user avatar
1 vote
1 answer
72 views

I want to print only chosen columns of lsof output $1,$2,$3,$5,$8,$10 and use uniq -c on the PID column while printing all of the initial columns of output. I am on macOS. I am using awk, sort, uniq ...
John's user avatar
  • 456
0 votes
0 answers
60 views

I have two files file test.txt and ref.txt. I want to read ref.txt which has comma seperated 3 values. I want to match pattern in test.txt with first value in ref.txt, if found replace next line if ...
neil's user avatar
  • 1
0 votes
2 answers
209 views

lets say I want to pipe the date output in the beggining of some text for example echo "this line is test line" | date and expected output should be Wed May 22 14:55:10 UTC 2024 this line ...
King David's user avatar
  • 1,011

15 30 50 per page
1
2 3 4 5
43