Skip to main content

All Questions

Tagged with
0 votes
0 answers
71 views

Text processing grep and awk together on live script not working

I am using ssh to login to a remote server (Ubuntu), and then issue a command which outputs text/value each sec (live script). In the live output, I want to filter out the lines containing '...
SAM's user avatar
  • 1
-1 votes
2 answers
136 views

Grep a log file for SQL queries and their execution time

I have an application log file that also captures the execution time for each executed SQL statement, like below:- Sample logs: I 2023-11-15 07:18:00.743Z 1760463 37 ZVRwqItu6aw-b8eejMLI_gAAAAU 1@...
Arpit Jain's user avatar
2 votes
2 answers
309 views

Why does awk concatenate strings from different lines

Good day. I'm trying to run a ping6 on IPv6 addresses pulled from /etc/resolv.conf.dnsph. It seems though, as if awk is stringing the IPv6 addresses onto one line. $ grep ^nameserver /etc/resolv.conf....
Bjoern's user avatar
  • 31
3 votes
2 answers
396 views

Extract first word from txt file before ending with "/" sign in linux which contains "db" word in txt line

I have abc.txt file which contains two lines. I want to extract first word in line which contains db word in particular line. abc.txt: XYZ/db_abc.sql ijkl/tables/table_name/tl_abc.sql When I tried ...
Divyank's user avatar
  • 147
0 votes
1 answer
86 views

"grep -A" but with some lines removed

The problem The output of grep -A 4 davidson file.txt gives me: davidson 0 27 |r|= 0.00244 e= [-0.04073962 0.42777949 0.44157777 0.45997235 0.45997235 0.51613738 0.55005554 0.5538866 0....
Nike Dattani's user avatar
0 votes
5 answers
158 views

How to bring the next line to the end of the first line using awk, separated by a comma?

I have downloaded some sequences from a publicly available database in .fa format. I want to generate a .csv file that contains the name of the sequence, and its length, separated by a comma. This is ...
Hrishikesh Hardikar's user avatar
-2 votes
4 answers
80 views

How to keep previous and current line if the previous line contains common text?

How to keep previous and current line if the previous line contains common text? I have a main file like this: Hello_world Anna Frank Jeremy Hello_earth Jessie James I would want 3 output files like ...
jovicue's user avatar
  • 11
0 votes
4 answers
72 views

Awk multiline change

I have the following file for datadog ######################################## ## System Probe Network Configuration ## ######################################## # network_config: ## @param enabled -...
user9311662's user avatar
1 vote
2 answers
299 views

Extract IP:PORT from a curl output

I want to get list ip:port from the curl output of curl https://www.gametracker.com/search/?sort=5&order=ASC I cannot post the whole output as it is very big, just posting the part from where we ...
ph3ro's user avatar
  • 378
-3 votes
2 answers
80 views

Grep first charcter from the string

10:30:01 10:35:01 There is a time in a format, where i want to grep: Case1: 1 from 10 Case2: 3 from 30 Output as 1 3 0 10-17-22 date in a format where i want to grep 10, 17, 22, seperately. Output ...
Siva  E5209's user avatar
0 votes
1 answer
38 views

Save output of xdpdump to a variable

How can I save the output of xdpdump to a variable. I just want to save the number of packets captured. root@front:/home/ubuntu# timeout 2s xdpdump -i ens3 -w lol.pcap listening on ens3, ingress XDP ...
ph3ro's user avatar
  • 378
1 vote
5 answers
6k views

Print ONLY the next line after a match with awk

I have a command that prints the line directly after a match with several pipes using different tools like grep, awk, and tail. This works but it feels somewhat messy and uses multiple pipes to ...
AndG's user avatar
  • 303
0 votes
2 answers
94 views

Extract all subnets from its first common octet

I have a list of subnets in a file. I just need to extract those subnets which have common octet as mentioned. I tried using grep "grep -oP '1.[^"]+' but still I got some different results....
ph3ro's user avatar
  • 378
2 votes
1 answer
2k views

How to get specific fields of JSON objects for which another field is true

I want to get a specific info from the below command [root@test opc]# /bin/oci compute instance list-vnics --instance-id ocid1.instance.oc1.ap-mumbai-1....
ph3ro's user avatar
  • 378
0 votes
6 answers
530 views

awk, sed, or grep command to output boolean file for each word in file1 to check if it's existent or not in file2

I have two files, if the word in file 1 is not existent in file 2, I want to generate the word false in the corresponding line in a new file say file 3. Otherwise, I want to output true in the ...
M.A.G's user avatar
  • 271

15 30 50 per page
1
2 3 4 5
9