Sponsored Content
Full Discussion: Extract strings from output
Top Forums Shell Programming and Scripting Extract strings from output Post 303038689 by liviusbr on Wednesday 11th of September 2019 09:22:52 AM
Old 09-11-2019
Extract strings from output

I am having the following output when executing a dig command :



Code:
  dig @1.1.1.1 google.com  +noall +answer +stats


  ; <<>> DiG 9.11.4-P1 <<>> @1.1.1.1 google.com +noall +answer +stats
 ; (1 server found) 

;; global options: +cmd obodrm.prod.at.dmdsdp.com. 86154 IN     A       62.178.85.125 

;; Query time: 1 msec ;; SERVER: 1.1.1.1#53(1.1.1.1) 

;; WHEN: Wed Sep 11 15:04:35 CEST 2019 

;; MSG SIZE  rcvd: 70





I want to filter out and display on a line the following "62.178.85.125" and Query time: 1 msec . Thanks for your help!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract strings between tags

Hi, I have data as follows in a text file <key='data1'> <String>abcdef</String> <String>abcdef1</String> <String>abcdef2</String> </key> <key='data2'> <String>abcdef</String> <String>abcdef1</String> <String>abcdef2</String> <String>abcdef3</String> </key> Is there a way i... (10 Replies)
Discussion started by: userscript
10 Replies

2. Shell Programming and Scripting

How extract strings (perl)

Sample data: revision001 | some text | some text Comment: some comment Brief: 1) brief 2) brief ------------------------------------------ revision002 | some text | some text Brief: 1) brief 2) brief FIX: some fix ------------------------------------------ revision003 | some... (8 Replies)
Discussion started by: inotech
8 Replies

3. Shell Programming and Scripting

Extract data between two strings

Hi , I have a billing CDR file which has repeated lines as indicated below and I need to extract data between two strings (i.e.: <?> and </?>). Eventually, map that information with the corresponding field. I'm new to unix, any help will be greatly appreciated. Gamini Input (single line): !... (3 Replies)
Discussion started by: jaygamini
3 Replies

4. Shell Programming and Scripting

How to Extract text between two strings?

Hi, I want to extract some text between two strings in a line i am using following command i.e; awk '/-string1/,/-string2/' filename contents of file is--- line1 line2 aaa -bbb -ccc -string1 c,d,e -string2 line4 but it is showing complete line which is having searched strings. aaa... (19 Replies)
Discussion started by: emresearch
19 Replies

5. Shell Programming and Scripting

Extract text between two strings

Hi I have something like this: EXAMPLE 1 CREATE UNIQUE INDEX "STRING_1"."STRING_2" ON "BOSNI_CAB_EVENTO" ("CD_EVENTO" , "CD_EJECUCION" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 5242880 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "DB1000_INDICES_512K"... (4 Replies)
Discussion started by: chrispaz81
4 Replies

6. Shell Programming and Scripting

Extract strings from file - Help

Hi, I have a file say with following lines (the lines could start from any column and there can be many many create statements in the file) create table table1....table definition... insert into table1 values..... create or replace view view1....view definition.... What i want is to... (2 Replies)
Discussion started by: whoami191
2 Replies

7. Shell Programming and Scripting

Extract two strings from a file and create a new file with these strings

I have the following lines in a log file. It would be great if some one can help me to create a new file with the just entries in the below format. 66.150.161.195 HPSAC=Z05 66.150.161.196 HPSAC=A05 That is just extract the IP address and the string DPSAC=its value 66.150.161.195 -... (1 Reply)
Discussion started by: Tuxidow
1 Replies

8. UNIX for Dummies Questions & Answers

Extract code between 2 strings.

Hi, Im having some problems with this. I have loaded a file with html code. All code is placed in the same line. I want to get everything between two given strings (including these strings and get only the first appearance). Example: File contains <html><body><a href='a.html'>abc</a><a... (5 Replies)
Discussion started by: ngb
5 Replies

9. UNIX for Dummies Questions & Answers

Extract strings based on the value

I have a file with multiple columns (in this case, the file has 3 columns): NM_001006304 (-33.7) XM_418228 (-38.4) JN880447 (-33.7) CR387600 (-33.7) CR524203 (-36.3) GALGA_6AKII_KRT75 (-33.7) GALGA25_SC7 (-31.9) CR352795 (-36.3) NM_204172 (-31.7) NM_204137 (-31.9) NM_001030561 (-36.3) AB011672... (7 Replies)
Discussion started by: yuejian
7 Replies

10. UNIX for Dummies Questions & Answers

Issue when using egrep to extract strings (too many strings)

Dear all, I have a data like below (n of rows=400,000) and I want to extract the rows with certain strings. I use code below. It works if there is not too many strings for example n of strings <5000. while I have 90,000 strings to extract. If I use the egrep code below, I will get error: ... (3 Replies)
Discussion started by: forevertl
3 Replies
Simple action in tc(8)						       Linux						    Simple action in tc(8)

NAME
simple - basic example action SYNOPSIS
tc ... action simple [ sdata STRING ] [ index INDEX ] [ CONTROL ] CONTROL := { reclassify | pipe | drop | continue | ok } DESCRIPTION
This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given STRING which may be of arbi- trary length. OPTIONS
sdata STRING The actual string to print. index INDEX Optional action index value. CONTROL Indicate how tc should proceed after executing the action. For a description of the possible CONTROL values, see tc-actions(8). EXAMPLES
The following example makes the kernel yell "Incoming ICMP!" every time it sees an incoming ICMP on eth0. Steps are: 1) Add an ingress qdisc point to eth0 2) Start a chain on ingress of eth0 that first matches ICMP then invokes the simple action to shout. 3) display stats and show that no packet has been seen by the action 4) Send one ping packet to google (expect to receive a response back) 5) grep the logs to see the logged message 6) display stats again and observe increment by 1 hadi@noma1:$ tc qdisc add dev eth0 ingress hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP" hadi@noma1:$ sudo tc -s filter ls dev eth0 parent ffff: filter protocol ip pref 5 u32 filter protocol ip pref 5 u32 fh 800: ht divisor 1 filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 match 00010000/00ff0000 at 8 action order 1: Simple <Incoming ICMP> index 4 ref 1 bind 1 installed 29 sec used 29 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 hadi@noma1$ ping -c 1 www.google.ca PING www.google.ca (74.125.225.120) 56(84) bytes of data. 64 bytes from ord08s08-in-f24.1e100.net (74.125.225.120): icmp_req=1 ttl=53 time=31.3 ms --- www.google.ca ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 31.316/31.316/31.316/0.000 ms hadi@noma1$ dmesg | grep simple [135354.473951] simple: Incoming ICMP_1 hadi@noma1$ sudo tc/tc -s filter ls dev eth0 parent ffff: filter protocol ip pref 5 u32 filter protocol ip pref 5 u32 fh 800: ht divisor 1 filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 match 00010000/00ff0000 at 8 action order 1: Simple <Incoming ICMP> index 4 ref 1 bind 1 installed 206 sec used 67 sec Action statistics: Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 SEE ALSO
tc(8) tc-actions(8) iproute2 12 Jan 2015 Simple action in tc(8)
All times are GMT -4. The time now is 04:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy