Sponsored Content
Top Forums Shell Programming and Scripting Need to extract string based on the alignment. Post 302998856 by RudiC on Thursday 8th of June 2017 05:10:43 PM
Old 06-08-2017
Try
Code:
awk '
        {AL = index ($0, "<")
         gsub (/<.?name>|^ */, _)
        }
        {printf "%s%s%s", AL==9?ORS:"", $0, AL==9?"\t":","
        }
END     {printf ORS
        }
' file

EvidenceAttackSystem    EAS.evidencesource,EAS.phase,EAS.operatingsystem,
ShareFolderPermissions    Share,Permissions,
MutationSpeciesVersion    
JPARInstalled    CONTENT_manufaturer.tr,
WindowsCDSDeviceType    DeviceManu,DeviceDetails,
FilteredCanClasses    
JasEventConsumers    Name,System,CommandSpeciesTemplate,CST.evidence_source,CST.attack_phase,CST.operating_system,

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

using sed to conditionally extract stanzas of a file based on a search string

Dear All, I have a file with the syntax below (composed of several <log ..... </log> stanzas) I need to search this file for a number e.g. 2348022225919, and if it is found in a stanza, copy the whole stanza/section (<log .... </log>) to another output file. The numbers to search for are... (0 Replies)
Discussion started by: aitayemi
0 Replies

3. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

4. Shell Programming and Scripting

Extract string from multiple file based on line count number

Hi, I search all forum, but I can not find solutions of my problem :( I have multiple files (5000 files), inside there is this data : FILE 1: 1195.921 -898.995 0.750312E-02-0.497526E-02 0.195382E-05 0.609417E-05 -2021.287 1305.479-0.819754E-02 0.107572E-01 0.313018E-05 0.885066E-05 ... (15 Replies)
Discussion started by: guns
15 Replies

5. Shell Programming and Scripting

to extract string from main string and string comparison

continuing from my previous post, whose link is given below as a reference https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569 consider there is create table commands in a file for eg: CREATE TABLE `Blahblahblah` ( `id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies

6. Shell Programming and Scripting

Extract a string between 2 ref string from a file

Hi, May i ask if someone share some command for extracting a string between 2 ref string in a txt file My objective: i had a file with multiple lines and wants only to extract the string "watch?v=IbkAXOmEHpY" or "watch?v=<11 random character>", when i used "grep 'watch?=*' i got a results per... (4 Replies)
Discussion started by: jao_madn
4 Replies

7. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

8. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

9. Shell Programming and Scripting

How to extract every repeated string between two specific string?

Hello guys, I have problem with hpux shell script. I have one big text file that contains like SOH bla bla bla bla bla bla ETX SOH bla bla bla ETX SOH bla bla bla ETX What I need to do is save first SOH*BLA into file1.txt, save second SOH*BLA into file2.txt and so on.... (17 Replies)
Discussion started by: sembii
17 Replies

10. Shell Programming and Scripting

Add Blank Spaces in text, to perform beter alignment of the string

Hi Guru, I need some advice on how to add blank spaces to the code, rather than me just adding <space-bar spaces> which does not work. Current output of the code File System Backed Up - ALL_LOCAL_DRIVES Daily - Incremental Backup Schedule - 1 Month Retention • 7pm - PRD... (2 Replies)
Discussion started by: Junes
2 Replies
smistrip(1)							     SMI Tools							       smistrip(1)

NAME
smistrip - extract MIB or PIB modules from text files, like RFCs or I-Ds SYNOPSIS
smistrip [ -Vhn ] [ -d dir ] [ -m module ] [ file(s) ] DESCRIPTION
The smistrip program is used to extract MIB and PIB module files from ASCII documents like RFCs or Internet Drafts. Modules are identified by a starting ASN.1 DEFINITIONS clause and the matching END clause. The output is written to files named by the modules' names. OPTIONS
-V Show the smistrip version and exit. -h Show a help text and exit. -n Print only what would be extracted, but do not write any output file. -d dir Write module file(s) to directory dir instead of the current working directory. -m module Extract only the module module instead of all modules found in the input file(s). file(s) The input text file(s) from which modules will be extracted. If no file is given, input is read from stdin. Note that smistrip tries to be smart about locating module start and end, detecting page breaks and blank lines near page breaks. It also tries to cut off blank prefixing columns from all lines of a modules. However, there might by documents that cannot be parsed correctly by smistrip and probably produce incorrect output. You might consider to use smilint on every extracted module file to check its syntactical correctness. EXAMPLE
This example extracts only the module IPV6-MIB from the file rfc2465 and writes it to the directory /usr/local/tmp. $ smistrip -d /usr/local/tmp -m IPV6-MIB rfc2465 SEE ALSO
The libsmi(3) project is documented at http://www.ibr.cs.tu-bs.de/projects/libsmi/. smilint(1) AUTHOR
(C) 1999-2004 F. Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de> (C) 2002 M. Bunkus, TU Braunschweig, Germany <bunkus@ibr.cs.tu-bs.de> and contributions by many other people. IBR
August 10, 2004 smistrip(1)
All times are GMT -4. The time now is 09:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy