Sponsored Content
Top Forums Shell Programming and Scripting Need to extract string based on the alignment. Post 302998855 by ramprabhum on Thursday 8th of June 2017 04:58:18 PM
Old 06-08-2017
Lightbulb Need to extract string based on the alignment.

Finding very hard time to achieve this.
I have a text file extracted from XML file. The text file which is extracted is very large & has multiple blocks similar to the sample file given below

Code:
        <name>Evidence Attack System</name>
                <name>EAS.evidence source</name>
                <name>EAS.phase</name>
                <name>EAS.operating system</name>
        <name>Share Folder Permissions</name>
                <name>Share</name>
                <name>Permissions</name>
        <name>Mutation Species Version</name>
        <name>JPAR Installed</name>
                <name>CONTENT_manufaturer.tr</name>
        <name>Windows CDS Device Type</name>
                <name>Device Manu</name>
                <name>Device Details</name>
        <name>Filtered Can Classes</name>
        <name>Jas Event Consumers</name>
                <name>Name</name>
                <name>System</name>
                <name>Command Species Template</name>
                <name>CST.evidence_source</name>
                <name>CST.attack_phase</name>
                <name>CST.operating_system</name>

All I need to achieve is based on the alignment I need the output as given below

Code:
Evidence Attack System		EAS.evidence source,EAS.phase,EAS.operating system
Share Folder Permissions	Share,Permissions
Mutation Species Version
JPAR Installed		        CONTENT_manufaturer.tr
Windows CDS Device Type		Device Manu,Device Details
Filtered Can Classes
Jas Event Consumers		Name,System,Command Species Template,CST.evidence_source,CST.attack_phase,CST.operating_system


Last edited by Don Cragun; 06-08-2017 at 10:58 PM.. Reason: Change HTML tags to CODE tags.
 

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
Device::USB::PCSensor::HidTEMPer::TEMPer(3pm)		User Contributed Perl Documentation	     Device::USB::PCSensor::HidTEMPer::TEMPer(3pm)

       Device::USB::PCSensor::HidTEMPer::TEMPer - The HidTEMPer thermometer

VERSION
Version 0.02 SYNOPSIS
None DESCRIPTION
This is the implementation of the HidTEMPer thermometer that have only one internal sensor measuring the temperature. It is important to notice that the TEMPer device with one external sensor will not function, although being recognized correctly. CONSTANTS None METHODS o init() Initialize the device, connects the sensors and makes the object ready for use. INHERIT METHODS FROM
Device::USB::PCSensor::HidTEMPer::Device DEPENDENCIES
This module internally includes and takes use of the following packages: use Device::USB::PCSensor::HidTEMPer::Device; use Device::USB::PCSensor::HidTEMPer::TEMPer::Internal; This module uses the strict and warning pragmas. BUGS
Please report any bugs or missing features using the CPAN RT tool. FOR MORE INFORMATION
None AUTHOR
Magnus Sulland < msulland@cpan.org > ACKNOWLEDGEMENTS
None COPYRIGHT &; LICENSE Copyright (c) 2010 Magnus Sulland This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-24 Device::USB::PCSensor::HidTEMPer::TEMPer(3pm)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy