Sponsored Content
Full Discussion: Parsing with keywords
Top Forums Shell Programming and Scripting Parsing with keywords Post 302696287 by alpesh on Tuesday 4th of September 2012 03:11:40 PM
Old 09-04-2012
Parsing with keywords

Hi All,

Please help with code for this.
I want to parse several huge files and summarize relevant information into columns.
The columns of output are title, pagebegin,pageend, author1,author2....,author8, abstract. Column descriptions are as follows.

Title
Line after single integer value in a particular line.The preceeding entire line
has only one value. In the example it is 3.

example
3
Building transformational leadership

title = Building transformational leadership

Pages

Preceeded by keyword "Pages"

pagebegin will be first value after keyword "Pages"
pageend will be value after pagebegin and '-'

Example
Pages 309-323

pagebegin = 309
pageend = 323

Authors

Immediate next line after "Pages" line separated by commas. Can be upto 8 authors. Only last name needed.

Pages 309-323
Peter Sun, H. Anderson

author1 = Sun
author2 = Anderson
...

Abstract

Text between keywords "Abstract" and "Article Outline"

Example input file

Code:
2		
Relational commitments for employee
Pages 293-308
Guylaine Landry, Christian Vandenberghe
 Close preview  |   PDF (432 K)   |   Related articles  |  Related reference work articles    
Abstract | Figures/Tables | References
Abstract

We investigated employee commitment to the supervisor and supervisor commitment to the employee within employee–supervisor dyads. 
Article Outline

1. The relevance of relational commitments
2. Mindsets of employee and supervisor commitments


3		
Building transformational leadership 
Pages 309-323
Peter Y.T. Sun, Marc H. Anderson
    
Abstract | Figures/Tables | References
Abstract

An emerging stream of work has been investigating the leadership processes necessary to guide public multi-sector collaborations. 
Article Outline

1. Transformational leadership
2. What is missing from transformational leadership

References


Sample Output (2 lines)

Code:
Relational commitments for employee 	293 	308 	Landry	 Vandenberghe 	We investigated... employee–supervisor dyads.
Building transformational leadership	309	323	Sun	 Anderson 	An emerging  to ... public multi-sector collaborations.

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding use and require keywords

Hi, what is the difference between use and require keywords in Perl. What is the significance of these lines (what it mean, what is the use of this) #!/usr/bin/perl -w // In Perl script.... #!/bin/ksh //In shell script..... Thanks Sweta (2 Replies)
Discussion started by: sweta
2 Replies

2. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

3. Shell Programming and Scripting

How to cut id between keywords?

Hi, how to cut id from line ? ....<a class='adata' href='User.php?uid=545554'>.... to 545554 (3 Replies)
Discussion started by: Trump
3 Replies

4. Shell Programming and Scripting

Search a file with keywords

Hi All I have a file of format asdf asf first sec endi asdk rt 123 ferf dfg ijglkp (7 Replies)
Discussion started by: mailabdulbari
7 Replies

5. Shell Programming and Scripting

searching keywords in file

hey guys, Hey all, I'm doing a project currently and want to index words in a webpage. So there would be a file with webpage content and a file with list of words, I want an output file with true and false that would show which word exists in the webpage. example: Webpage content... (2 Replies)
Discussion started by: Johanni
2 Replies

6. Shell Programming and Scripting

Extract word between two KEYWORDS

Hi I want to extract all the words between two keywords HELLO & BYE. eg: Input 1_HELLO_HOW_ARE_YOU_BYE_TEST 1_HELLO_WHERE_ARE_BYE_TEST 1_HELLO_HOW_BYE_TEST Output Required: HOW_ARE_YOU WHERE_ARE HOW (7 Replies)
Discussion started by: dashing201
7 Replies

7. Shell Programming and Scripting

Grep Keywords one by one

Hi I am trying to determine number of lines having a specific keyword. So for that I am using below query: grep -i 'keyword1' filename|wc -l This give me number of lines. Perfect for me. However now the requirement is I have multiple keywords together... and I have to find number of... (3 Replies)
Discussion started by: dashing201
3 Replies

8. Shell Programming and Scripting

How to grep keywords?

I have below text file only with one line: vi test.txt This is the first test from a1.loa1 a1v1, b2.lob2, "c3.loc3" c3b1, loc4 but not from mot3 and second test from a5.loa5 Below should be the output that i want: a1.loa1 b2.lob2 c3.loc3 loc4 a5.loa5 alv1 and c3b1 should be... (3 Replies)
Discussion started by: khchong
3 Replies

9. AIX

Filtering keywords from syslog.

Hi, My syslog in AIX forwards all user facility to a specific log /logs/user.log I need to further segregate the user.log to logs specific to various applications and i was wondering if i can make some configuration change to syslog.conf to forward messages based on a certain keyword? for... (2 Replies)
Discussion started by: roshan.171188
2 Replies
aliases(5)							File Formats Manual							aliases(5)

Name
       aliases - aliases file for sendmail

Description
       The  aliases  file  is  an ASCII file that describes user ID aliases that are used in It is formatted as a series of lines in the following
       form:
       name: name_1, name2, name_3, . . .
       The name is the name to alias, and the name_n are the aliases for that name.  Each is separated from the next by a new line.

       Continuation lines begin with white space.  Comment lines begin with a number sign (#).

       You can only assign aliases to local names.  Loops are not allowed because a message should be sent to a person only once.

       After an alias has been applied, local and valid recipients who have a file in their home directory can have messages forwarded to the list
       of users defined in that file.

       This  is  only the raw data file; the actual information pertaining to aliases is placed into binary format in the files and using the pro-
       gram The command should be executed each time the aliases file changes.	This command allows the new changes to take effect.

Restrictions
       Because of restrictions in a single alias cannot contain more than approximately 1000 bytes of information.  You can specify longer aliases
       by chaining; that is, use a dummy name for the last name in the alias, which creates a continuation alias.

       The  database  may  be distributed in a network by a naming service, such as Yellow Pages or BIND/Hesiod.  See the Guide to Yellow Pages or
       the chapter on Hesiod in the Guide to BIND for setup information.

Files
See Also
       newaliases(1), dbm(3x), sendmail(8)
       "SENDMAIL Installation and Operation Guide", ULTRIX Supplementary Documents, Vol. III: System Manager
       Guide to the BIND/Hesiod Service
       Guide to the Yellow Pages Service

																	aliases(5)
All times are GMT -4. The time now is 06:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy