Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extraction of strings from a file, after pattern matching Post 302566816 by abkush on Friday 21st of October 2011 07:44:08 AM
Old 10-21-2011
Output for the given portion of the file i.e.

Input File:

Plan ABCD
IN-+-172BB---118C2C---GGN_342-+-MM77_23--+-LAS24_3|GGK_774
| | \-LAS24_2|GGN_774
| +-AA_800_1-+-BAS_000|GGK_362
| | \-BAS_001|GGK_360
| \-DD_000T1---DAM_001|STEEL_0


Plan SHELL_1
IN-+-CRCBB---118C2D---FRB_342-+-SS77_23--+-LAS20_1|GGK_734
| +-AB_800_1-+-BAS_001|GGK_332
| | \-BAS_003|GGK_700




Output will consists of 3 files, like below

File_1 with below data

Plan ABCD,
Plan SHELL_1

File_2 with below data

172BB
118C2C
GGN_342
MM77_23
AA_800_1
DD_000T1
CRCBB
118C2D
FRB_342
SS77_23
AB_800_1

File_3 with below data

LAS24_3|GGK_774
LAS24_2|GGN_774
BAS_000|GGK_362
BAS_001|GGK_360
DAM_001|STEEL_0
LAS20_1|GGK_734
BAS_001|GGK_332
BAS_003|GGK_700
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern matching for file

Hi All, I'm new to perl, My requirement is to check if particular file exists. e.g. filename.txt, filename1.txt, filename2.txt etc I tried the below code:- my $var1 = "filename.txt" if ( -e ($var1 = ~ /file\w/)) { print "File found \n"; } else { print "File not found \n"; } ... (0 Replies)
Discussion started by: doitnow
0 Replies

2. UNIX for Advanced & Expert Users

extraction of data from a text file which follows certain pattern

hi everybody, i have a file, in it I need to extract some data that follows a particular pattern.. For example: my file contains like now running Speak225 sep 22 mon 16:34:05 2008 -------------------------------- ... (4 Replies)
Discussion started by: mohkris
4 Replies

3. Programming

File Pattern Matching C++

Hi, I have large files with fixed length fields or fields seperated by delimeter. I would like to do validation on some or all fields to check for numeric or date or characters etc.. I would like to write this in C++. Please let me know if any one have any ideas on this. Thanks for all... (2 Replies)
Discussion started by: rameshmelam
2 Replies

4. Shell Programming and Scripting

Extracting the strings matching a pattern from a word

Hi All , I need to extract the strings that are matching with the pattern : CUST.<AnyStringOfAnyLength>.<AnyStringOfAnyLength> from a file and then write all these string into another file. e.g. If a file SOURCE contains following lines : IF(CUST.ABCD.EFGH==1) THEN CUST.ABCD.EFGH =... (7 Replies)
Discussion started by: swapnil.nawale
7 Replies

5. Shell Programming and Scripting

Help with matching pattern inside a file

I have a huge file that has roughly 30304 lines. I need to extract specific info from that file. For example, Box 1 > *aaaaaaaajjjj* > hbbvjvj > jdnnfddllll > *dgdfhfekwjh* Box 2 > *aaaaaaa'aj'jjj* > dse hkjuejef bfdw > dyeee > dsewq > *dgdfhfekwjh* >feweiuei Box 3 > *aaaa"aaaaj"jjj* >... (25 Replies)
Discussion started by: Ernst
25 Replies

6. Shell Programming and Scripting

Get matching string pattern from a file

Hi, file -> temp.txt cat temp.txt /home/pradeep/123/a_asp.html /home/pradeep/123/a_asp1.html /home/pradeep/435/a_asp2.html /home/pradeep/arun/abc/a_dfr.html /home/pradeep/arun/123/a_kir.html /home/pradeep/123/arun/a_dir.html .... .... .. i need to get a_*.html(bolded strings... (4 Replies)
Discussion started by: pradebban
4 Replies

7. Shell Programming and Scripting

Need to append matching strings in a file

Hi , I am writing a shell script to check pvsizes in linux box. # for i in `cat vgs1` > do > echo "########### $i ###########" > pvs|grep -i $i|awk '{print $2,$1,$5}'>pvs_$i > pvs|grep -i $i|awk '{print $1}'|while read a > do > fdisk -l $a|head -2|tail -1|awk '{print $2,$3}'>pvs_$i1 >... (3 Replies)
Discussion started by: nanduri
3 Replies

8. Shell Programming and Scripting

Big pattern file matching within another pattern file in awk or shell

Hi I need to do a patten match between files . I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time. Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies

9. Shell Programming and Scripting

Help with tag value extraction from xml file based on a matching condition

Hi , I have a situation where I need to search an xml file for the presence of a tag <FollowOnFrom> and also , presence of partial part of the following tag <ContractRequest _LoadId and if these 2 exist ,then extract the value from the following tag <_LocalId> which is "CW2094139". There... (2 Replies)
Discussion started by: paul1234
2 Replies

10. UNIX for Beginners Questions & Answers

(g)awk: Matching strings from one file in another file between two strings

Hello all, I can get close to what I am looking for but cannot seem to hit it exactly and was wondering if I could get your help. I have the following sample from textfile with many thousands of lines: File 1 PS001,001 HLK PS002,004 L<G PS004,002 XNN PS004,006 BVX PS004,006 ZBX=... (7 Replies)
Discussion started by: jvoot
7 Replies
RDF::Query::Plan::Extend(3pm)				User Contributed Perl Documentation			     RDF::Query::Plan::Extend(3pm)

NAME
RDF::Query::Plan::Extend - Executable query plan for Extends. VERSION
This document describes RDF::Query::Plan::Extend version 2.908. METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Query::Plan class. "new ( $plan, @keys )" "execute ( $execution_context )" "next" "close" "pattern" Returns the query plan that will be used to produce the data to be extended. "distinct" Returns true if the pattern is guaranteed to return distinct results. "ordered" Returns true if the pattern is guaranteed to return ordered results. "plan_node_name" Returns the string name of this plan node, suitable for use in serialization. "plan_prototype" Returns a list of scalar identifiers for the type of the content (children) nodes of this plan node. See RDF::Query::Plan for a list of the allowable identifiers. "plan_node_data" Returns the data for this plan node that corresponds to the values described by the signature returned by "plan_prototype". "graph ( $g )" "explain" Returns a string serialization of the plan appropriate for display on the command line. AUTHOR
Gregory Todd Williams <gwilliams@cpan.org> perl v5.14.2 2012-01-31 RDF::Query::Plan::Extend(3pm)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy