Sponsored Content
Top Forums Shell Programming and Scripting shellscript to find a line in between a particular set of lines of a text file Post 302279810 by millan on Saturday 24th of January 2009 12:21:52 AM
Old 01-24-2009
shellscript to find a line in between a particular set of lines of a text file

i have a file a.txt and following is only one portion.
I want to search <branch value="/dev36/AREA/" include="yes"></branch> present in between
<template_file name="Approve External" path="core/approve/bin" and </template_file>
where the no of lines containing "<branch value= " is increasing



file contents:-

CTYPE available_templates SYSTEM './available_templates.dtd'>

<available_templates>

<template_file name="Approve External" path="core/approve/bin"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role allusers="yes" include="yes" value="editor"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>
</template_file>
<template_file ="Workflow" path="core/sanj"
<command_list>
<command value="new_job"></command>
<command include="no" value="all"></command>
</command_list>
<role_list>
<role allusers="yes" include="yes" value="editor"></role>
<role allusers="yes" include="yes" value="admin"></role>
<role allusers="yes" include="yes" value="master"></role>
<role include="no" value="all"></role>
</role_list>
<branch_list>
<branch value="all" include="no"></branch>
<branch value="/devAREA/" include="yes"></branch>
<branch value="/upgrade_test/AREA/include="yes"></branch>
<branch value="/dev4/AREA/" include="yes"></branch>
<branch value="/dev36/AREA/" include="yes"></branch>
<branch value="/dev05/" include="yes"></branch>
<branch value="/mandsmoney/AREA/" include="yes"></branch>
</branch_list>

</template_file>

Please help me write a shellscript
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print the lines after 2nd line from text file

Hi All, I need to print the lines after 2nd line irrespective of the number of lines in file if the file contents are like below ---------- root:!:0:0::/root:/usr/bin/ksh daemon:!:1:1::/etc: bin:!:2:2::/bin: sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm: uucp:!:5:5::/usr/lib/uucp:... (6 Replies)
Discussion started by: ram1729
6 Replies

2. Shell Programming and Scripting

use shellscript to find the count of a line in a set of lines

I have a file a.xml some portion of the file is given below.But the file format is same. CTYPE available_templates SYSTEM './available_templates.dtd'> <available_templates> <template_file name="Approve External" path="core/approve/bin" <command_list> <command... (1 Reply)
Discussion started by: millan
1 Replies

3. Shell Programming and Scripting

Find lines in text file with certain data in first field

Hi all, Sorry for the title, I was unsure how to word my issue. I'll get right to the issue. In my text file, I need to find all lines with the same data in the first field. Then I need to create a file with the matching lines merged into one. So my original file will look something like... (4 Replies)
Discussion started by: rstev39147
4 Replies

4. UNIX for Dummies Questions & Answers

find uniq lines in file, using the first field of line

Hello all, new to unix and have just found the forum. I think I will be here quite often, and hope that in time i will be able to provide soem help, role on not being a newbie anymore :) I have a question which iI am hoping someone could help me with. If i have a file with lines in in thus... (8 Replies)
Discussion started by: grom
8 Replies

5. Shell Programming and Scripting

find digit which is greater than 1000 in text -using shellscript

Hi All, I am having an abc.txt , which contains some digits Eg:abc.txt 145 566 355 I want write shellscript in suchway that if any digit is greter than 1000 then it shuld display " text files contain digit, which is greater than 1000" Please help me to do so Thanks.. (8 Replies)
Discussion started by: pspriyanka
8 Replies

6. UNIX for Advanced & Expert Users

Find and replace the line in text file

I have two files a.txt b.txt I want to find a line in a.txt and replace by another line from b.txt a.txt asfsdfsfsfdfsf asfwererfgdgf wrerwetretfdg b.txt werdfgdfgf werergfdgd sfdfgfgfgfgg i want to replace the 1st line of a.txt by 1st line of b.txt i want out put as (5 Replies)
Discussion started by: rammm
5 Replies

7. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

8. UNIX for Advanced & Expert Users

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

Hi , i have a file with data as below.This is same file. But actual file contains to many rows. i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ? Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies

9. UNIX for Dummies Questions & Answers

Ignore all lines except the --- dash line in a text file.

How do you write a script to ignore all lines except the --- dash lines and then remove --- dashes from the data in a text file? Also how do you separate data in a text file with a tab (for example, column1 (software) and column2 (date) ) ? Here is my scripts : I am getting errors in... (3 Replies)
Discussion started by: dellanicholson
3 Replies

10. Shell Programming and Scripting

Find all lines in file such that each word on that line appears in at least n lines of the file

I have a file where every line includes four expressions with a caret in the middle (plus some other "words" or fields, always separated by spaces). I would like to extract from this file, all those lines such that each of the four expressions containing a caret appears in at least four different... (9 Replies)
Discussion started by: uncleMonty
9 Replies
pdbtxt2html(1)						      General Commands Manual						    pdbtxt2html(1)

NAME
pdbtxt2html - Doc Text to HTML converter for Palm Pilots SYNOPSIS
pdbtxt2html [ -t ] file.txt [ file.html ] pdbtxt2html -v DESCRIPTION
pdbtxt2html converts text converted from a Doc(4) file via txt2pdbdoc(1) to HTML. If no HTML filename is given, the generated HTML is sent to standard output. Document Title The first line of the file is used for the HTML document title. Bookmarks The last line of the file is examined and, if it contains a string enclosed between < and >, that is taken to be the bookmark marker. The entire file is then scanned looking for lines beginning with it (ignoring leading whitespace). These lines are converted to HTML headings. The number of whitespace characters after the first bookmark marker is used for heading level 1. The level of subsequent headings is set to the number of whitespace characters between the bookmark marker and the bookmark text minus the number for the first bookmark plus one. Embedded URLs Valid URLs (according to RFC 1630) embedded in the text are turned into hyperlinks. The ftp, gopher, http, https, mailto, news, telnet, and wais URLs are recognized. OPTIONS
-t Compile a table of contents and insert it between the first heading and the body. -v Print the version number to standard output and exit. EXAMPLE
To convert a Doc file to HTML: txt2pdbdoc alice.pdb alice.txt pdbtxt2html alice.txt alice.html SEE ALSO
html2pdbtxt(1), txt2pdbdoc(1), doc(4), pdb(4) Tim Berners Lee. Universal Resource Identifiers in WWW, Network Working Group of the Internet Engineering Task Force, June 1994. http://info.internet.isi.edu/in-notes/rfc/files/rfc1630.txt AUTHOR
Paul J. Lucas <pauljlucas@mac.com> txt2pdbdoc January 21, 2005 pdbtxt2html(1)
All times are GMT -4. The time now is 03:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy