Sponsored Content
Top Forums Shell Programming and Scripting awk? extract quoted "" strings from multiple lines. Post 302660959 by Scrutinizer on Sunday 24th of June 2012 04:14:27 AM
Old 06-24-2012
Hi, try this:
Code:
awk '
  /NOTIFICATION-TYPE/{
    if(s)print s
    s=sprintf("%10-s",$1)
  } 
  f>0{
    $1=$1
    s=s OFS $0
  }
  /"/{
    f--
  } 
  /DESCRIPTION/{
    f=2
  } 
  END{
    if(s)print s
  }
' infile

These 2 Users Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

Extract Part of a "Word", using AWK or SED????

I have been lurking on this forum for some time now and appreciate Everyone's help. I need to find a way to get the SystemID from this XML file. The file is much larger than just this one line but I can grep and get this line Printed. But really just need the "systemid". <test123: prefintem... (9 Replies)
Discussion started by: elbombillo
9 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

Extract text between two specified "constant" texts using awk

Hi All, From the title you may know that this question has been asked several times and I have done lot of Googling on this. I have a Wikipedia dump file in XML format. All the contents are in one XML file i.e. all different topics have been put in one XML file. Now I need to separate them and... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

7. Shell Programming and Scripting

AWK for multiple line records RS="^" FS="#"

I have to pull multiple line records with ^ as the record separator(RS)... # should be my field separator (FS)... Sample record is: ^-60#ORA-00060: deadlock detected while waiting for resource ORA-00001: unique constraint (SARADM.TCKNUM_PK) violated#PROC:AVAILABLE_FOR_GETNXTTIC#02/27/2012... (7 Replies)
Discussion started by: Vidhyaprakash
7 Replies

8. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

9. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

10. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies
mtu(8)							      System Manager's Manual							    mtu(8)

NAME
mtu - POLYCENTER Common Agent MIB Translator Utility SYNOPSIS
/usr/sbin/mtu [-ccode] [-i] [-l] file.mib [file.mib]... OPTIONS
Specify the EMA entity code to be assigned to the root entity. Produce an informational parameter file for input to the POLYCENTER Common Agent momgen utility (file.par). Produce a listing file containing the MIB information from the file.mib file and a summary of the mapping to EMA hierarchical structures in the file.lis file. DESCRIPTION
The mtu utility translates MIB specification files (.mib) into EMA Management Specification files (.ms). The management specifications can be loaded into the POLYCENTER Common Agent Management Information Repository (MIR) by the /usr/sbin/mirc utility. The MIB structure and syntax is described by Concise MIB Definitions (RFC-1212). The EMA Management Specification Language is described by the DECmcc System Reference Manual. If the Common Agent Developer's Toolkit layered product is installed, the mtu utility can also produce momgen information files (file.par) from the MIB specification. EXAMPLES
The following example translates the superbox.mib MIB file into the MSL file superbox.msl (named by derivation), specifying 1000 as the EMA root entity. An information parameter superbox.par is created that can be use with the momgen utility. # mtu -c 1000 -i superbox.mib The following example translates all of the MIB files in the current working directory into MSL files. For each MIB file, mtu produces the MSL file (.msl), a listing file (.lis), and a momgen informational parameter file (.par). # mtu -i -l *.mib The following example translates the tinybox.mib MIB file into the MSL file tinybox.msl, specifying 500 as the EMA root entity. A momgen informational parameter file (tinybox.par) is also generated. The smallbox.mib MIB file is translated into the MSL file smallbox.msl, specifying 1000 as the EMA root entity. A momgen informational parameter file (smallbox.par) is also generated. # mtu -c 500 -i tinybox.mib -c 1000 -i smallbox.mib FILES
A listing file that contains a numbered version of the MIB input file followed by a hierarchical management specification summary. If errors are encountered, this file contains the diagnostic at the line where the error occurred. MIB input file. MSL output file. The momgen informational parameter file. It contains class, parent, and prefix information used by the momgen utility when generating a Man- aged Object Module. SEE ALSO
Concise MIB Definition (RFC 1212) Convention for Defining Traps (RFC 1215) DECmcc System Reference Manual mtu(8)
All times are GMT -4. The time now is 03:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy