Extract data between two markers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract data between two markers
# 1  
Old 09-12-2010
Extract data between two markers

Data in my jsp file is as follows:
Extract the name of all include page jsp file name
<!--- Global Nav Start -->
<jsp:include page="/includes/GlobalNav.jsp" >
<jspSmiliearam name="CMCat" value="TechProp" />
</jsp:include>
<!--- Global Nav End -->
<!-- Primary Nav Start -->
<jsp:include page="/includes/PrimaryNav.jsp" flush="true" />
<!-- Primary Nav End -->

<!-- Secondary Nav Start -->
<jsp:include page="/includes/SecondaryNav.jsp" flush="true" />
<!-- Secondary Nav End -->
<!--Language Link Start -->
<jsp:include page="/includes/LangLink.jsp" flush="true" />
<!--Language Link End -->
<!-- Main Content and Left Navigation start -->
<table width="760" bgcolor="#FFFFFF" height="22" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="151" valign="top">
<!--Left Navigation start -->
<jsp:include page="/accounts/includes/LeftNav.jsp" flush="true" />
<!-- Left Navigation End -->

My output should look like this
/includes/GlobalNav.jsp
/includes/PrimaryNav.jsp
/includes/LangLink.jsp
/accounts/includes/LeftNav.jsp

use sed or awk
# 2  
Old 09-12-2010
Are you asking for someone to write a script for you? Please post the commands/logic you have written so far and what issues you are having.
# 3  
Old 09-12-2010
Request for help

Hi Frank I am novice in Unix, the task given to me was to extract the name of all include files from over 2000 .jsp files, i was told that awk or sed could do the job.

Logic behind is to collect names of all include files with their paths.

Thanks
# 4  
Old 09-12-2010
Quote:
Originally Posted by rajkdutta
Hi Frank I am novice in Unix, the task given to me was to extract the name of all include files from over 2000 .jsp files, i was told that awk or sed could do the job.

Logic behind is to collect names of all include files with their paths.

Thanks
Here's a tutorial about sed
Go and study it to figure what this does:

Code:
sed -n -e 's/^.*page="\([^"]*\).*$/\1/p' jsp.file

Here's a tutorial about awk
Go and study it to figure what this does:

Code:
awk -F'"' '/page/ {print $2}' jsp.file


Last edited by Aia; 09-12-2010 at 10:09 PM..
# 5  
Old 09-12-2010
Thanks Aia

Thanks Aia U made my day. Works like a charm. U Rock
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed substitution depending on trailing markers

I have a pattern Preceding a # hash in a string which needs to be substituted. However, the substitution value will depend on the content of the last few characters, (_ABC or _RW) of whole stream. I was thinking sed should be used but I' haven't been able to figure it out the right combo. Is sed... (4 Replies)
Discussion started by: jy6383
4 Replies

2. Shell Programming and Scripting

Extract data from a file

Hello All, I have a small xml file which looks like below: <Check:defaultval Val="crash" value="crash_report_0013&#xA;generate_check_0020 generate_check_0022&#xA;&#xA;This is where the fault is."/> <Check:defaultval Val="crash" value="crash_report_1001&#xA;generate_check_1001... (9 Replies)
Discussion started by: suvendu4urs
9 Replies

3. Shell Programming and Scripting

Extract header data from one file and combine it with data from another file

Hi, Great minds, I have some files, in fact header files, of CTD profiler, I tried a lot C programming, could not get output as I was expected, because my programming skills are very poor, finally, joined unix forum with the hope that, I may get what I want, from you people, Here I have attached... (17 Replies)
Discussion started by: nex_asp
17 Replies

4. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

5. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

6. Shell Programming and Scripting

how to extract the data ?

Hi, I'm trying to pick out a data field eg. from below. I need the required field as below but they are filled sometimes with weird chars like \-(. or watever. How can I accurately extract the 3rd field in shell? :confused: ID IDNO - REQUIRED FIELD ID 1447 - MAT620BR. ID 1452 -... (13 Replies)
Discussion started by: uxnoob
13 Replies

7. Shell Programming and Scripting

extract data from a data matrix with filter criteria

Here is what old matrix look like, IDs X1 X2 Y1 Y2 10914061 -0.364613333 -0.362922333 0.001691 -0.450094667 10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies

8. UNIX for Dummies Questions & Answers

End of record markers

I have a file with thousands of 80 character records. Unfortunately, there are no end of record characters, so any normal script commands that I've tried will process the entire file as one record. I.E. If I use grep to find the record that contains some specific value, I either get nothing... (3 Replies)
Discussion started by: Dave Miller
3 Replies

9. Shell Programming and Scripting

how to extract a data from a column?

Hi All, Consider the below column, say this is the 4th column in a file PROV_STATS:::919900546978::Nokia 6600 PROV_STATS:::919900546978::Nokia 6600 PROV_STATS:::919900546978::Nokia 6600 I wanted to extract only 919900546978 from the 4 th cloumn using unix scripting? Kindly help (8 Replies)
Discussion started by: Balaji Sukumara
8 Replies

10. Shell Programming and Scripting

Extract data from file

Dear All , I am posting first time in this forum . Please ignore my mistakes . I am learning Unix and i need help to extract specific data from file . 1. I want to grep number of fails from log . The file contains "fails" word in line if test cases are failed . 2. The log contains... (20 Replies)
Discussion started by: getdpg
20 Replies
Login or Register to Ask a Question