Sponsored Content
Top Forums Shell Programming and Scripting Read text between two lines containing a string Post 302768367 by ysrini on Friday 8th of February 2013 12:01:05 PM
Old 02-08-2013
Read text between two lines containing a string

Hi,
I have text file like the following:
Code:
Start
a
b
121
c
d
End
Start
a
31
e
f
End
Start
p
o
i
k
l
993
End

Now I want to output the Start-End block that contains my search string
So if I search for '121' it should output the first block, search for 'k' then output the last block

Thanks,
-sri
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Read text file from a specified string to the end

Hi All, I like to read the log file from specific time to end of the file. eg: message date and time message 1 date and time1 message 2 EOF I want to read all the text (Messages) after date and time to end of the file. Please let me know the UNIX command to perform this?. Thanks,... (9 Replies)
Discussion started by: bsrajirs
9 Replies

2. Shell Programming and Scripting

Read any lines of text from file

Witam wszystkich , Jest to moj pierwszy post i już prośba ale gdybym potrafił zaradzić problemowi to nie zawracałbym nikomu głowy . mianowicie : Mam jakis 'plik' w ktorym są osadzone pojedyncze i zmienne słowa po jednym w lini czyli : test1 tekttw resst .... itd. Moje... (6 Replies)
Discussion started by: versace
6 Replies

3. Shell Programming and Scripting

Shell script to read lines in a text file and filter user data

hi all, I have this file with some user data. example: $cat myfile.txt FName|LName|Gender|Company|Branch|Bday|Salary|Age aaaa|bbbb|male|cccc|dddd|19900814|15000|20| eeee|asdg|male|gggg|ksgu|19911216||| aara|bdbm|male|kkkk|acke|19931018||23| asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies

4. Shell Programming and Scripting

print string at the end of lines in text file

hello, I go text file like this E:/DDD/Dyndede/wwww E:/DDD/sss.com/ffffg/fff E:/DDD/vvvvvv/dd E:/DDD/sss.com/bbbbbb E:/DDD/sss.com/nnnn/xxI want to print /alpha.jpg at the end of every lines like that E:/DDD/Dyndede/wwww/alpha.jpg E:/DDD/sss.com/ffffg/fff/alpha.jpg... (8 Replies)
Discussion started by: davidkhan
8 Replies

5. Shell Programming and Scripting

Print lines between two lines after grep for a text string

I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like: <ROW> some information more information </ROW> I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Discussion started by: jbruce
7 Replies

6. Shell Programming and Scripting

Extracting several lines of text after a unique string

I'm attempting to write a script to identify users who have sudo access on a server. I only want to extract the ID's of the sudo users after a unique line of text. The list of sudo users goes to the EOF so I only need the script to start after the unique line of text. I already have a script to... (1 Reply)
Discussion started by: bouncer
1 Replies

7. UNIX for Dummies Questions & Answers

Insert Text on lines having the string word

I need help on how I can accomplish my task. I hope someone can help me since I've researching and trying to accomplish this for hours now. Basically, I need to comment-out (or insert a # sign in the beginning of the line) a line when the line has the specific word I am searching. Example I have... (3 Replies)
Discussion started by: Orbix
3 Replies

8. Shell Programming and Scripting

Read all lines after a string appears in the file.

Hi All, I want to read all lines after a perticular string {SET UP VALUES}apprears in the file. SET UP values contains direcory, number of days and file type. Step1: Read all lines below SET UP VALUES string. Step2: If set up values are not present in each record then read from default... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies

9. Shell Programming and Scripting

Read n lines from a text files getting n from within the text file

I dont even have a sample script cause I dont know where to start from. My data lookes like this > sat#16 #data: 15 site:UNZA baseline: 205.9151 0.008 -165.2465 35.8109 40.6685 21.9148 121.1446 26.4629 -18.4976 33.8722 0.017 -165.2243 48.2201 40.6908 ... (8 Replies)
Discussion started by: malandisa
8 Replies

10. Shell Programming and Scripting

How to read all data after a specific string from a text file ?

Hi, I have a file(input.txt) and trying to format as output.txt. See the attached file format. Note: This is a windows file (DOS format) and the commands are also going to execute on windows. Basically I am trying to capture all the data in between Local Group Memberships and Global Group... (10 Replies)
Discussion started by: Monoj2014
10 Replies
me(7)							 Miscellaneous Information Manual						     me(7)

Name
       me - macros for formatting papers

Syntax
       nroff -me [ options ] file ...
       *roff -me [ options ] file ...

Description
       This package of and macro definitions provides a formatting facility for technical papers in various formats.  When producing 2-column out-
       put on a terminal, filter the output through

       Many and requests are unsafe in conjunction with this package; however, these requests can be used with impunity after the first .pp:

	      .bp     Begin new page
	      .br     Break output line here
	      .sp n   Insert n spacing lines
	      .ls n   Line spacing: n=1 single, n=2 double space
	      .na     No alignment of right margin
	      .ce n   Center next n lines
	      .ul n   Underline next n lines
	      .sz +n  Add n to point size

       Output of the and preprocessors for equations and tables is acceptable as input.

Requests
       In the following list, "initialization" refers to the first .pp, .lp, .ip, .np, .sh, or .uh macro.  This list is incomplete; see  the  "-me
       Reference Manual", Supplementary Documents, Volume 1: General User, for further details.

			   Request	Initial Cause Explanation	       Value   Break
			   .(b		-	yes   Begin	    block.	    .(c 	 -	 yes   Begin	    centered	    block.
			   .(d		-	no    Begin	   delayed	  text. 	.(f	     -	     no    Begin	 footnote.
			   .(l		-	yes   Begin list.  .(q		-	yes   Begin major quote.  .(x x        -       no    Begin
			   indexed item in  index.   x	.(z	     -	     no    Begin  floating  keep.   .)b 	 -	 yes   End  block.
			   .)c		-	yes   End	centered       block.	    .)d 	 -	 yes   End	delayed      text.
			   .)f		-	yes   End footnote.  .)l	  -	  yes	End  list.   .)q	  -	  yes	End  major
			   quote.  .)x		-	yes   End index item.  .)z	    -	    yes   End floating keep.
.++ m H      -	     no    Define paper section.  m defines the part of the paper, and can be (chapter), (appendix), (preliminary; for example, an
			   abstract, table of contents, and so on), (bibliography), (chapters renumbered from page one each chapter), or (appendix
			   renumbered from page one).
.+c  T	      -       yes   Begin chapter (or appendix, etc., as set by .++).  T is the chapter title.	.1c	     1	     yes   One-column for-
			   mat on a new page.  .2c	    1	    yes   Two-column format.  .EN	   -	   yes	 Space after equation pro-
			   duced  by  eqn  or  neqn.  .EQ x y	   -	   yes	 Precede equation; break out and add space.  Equation number is y.
			   The optional argument x may be I to indent equation (default), L to left-adjust the equation, or C to center the  equa-
			   tion.    .TE 	 -	 yes   End   table.    .TH	    -	    yes   End	heading  section  of  table.   .TS
			   x	    -	    yes   Begin table; if x is table has repeated heading.
.ac A N      -	     no    Set up for ACM style output.  A is the Author's name(s), N is the total number of pages.   Must  be	given  before  the
			   first initialization.  .b x	       no      no    Print x in boldface; if there is no argument, switch to boldface.
.ba  +n       0       yes   Augments  the  base  indent  by  n.   This	indent	is  used  to  set  the	indent	on regular text (like paragraphs).
			   .bc		no	yes   Begin new column.  .bi x	      no      no    Print x in bold italics  (nofill  only).   .bx
			   x	    no	    no	  Print x in a box (nofill only).
.ef 'x'y'z'  ''''    no    Set even footer to x  y  z.
.eh 'x'y'z'  ''''    no    Set even header to x  y  z.
.fo 'x'y'z'  ''''    no    Set footer to x  y  z.
.hx	     -	     no    Suppress   headers	and   footers	on   next   page.    .he   'x'y'z'  ''''    no	  Set	header	 to   x    y	z.
			   .hl		-	yes   Draw a horizontal line.  .i x	    no	    no	  Italicize x; if x missing,  italic  text
			   follows.   .ip  x y	    no	    yes   Start indented paragraph, with hanging tag x.  Indentation is y ens (default 5).
			   .lp		yes	yes   Start left-blocked paragraph.
.lo	     -	     no    Read in a file of local macros of the form .*x.  Must be given before initialization.  .np	       1       yes   Start
			   numbered paragraph.
.of 'x'y'z'  ''''    no    Set odd footer to x	y  z.
.oh 'x'y'z'  ''''    no    Set odd header to x	y  z.
.pd	     -	     yes   Print      delayed	   text.       .pp	    no	    yes   Begin      paragraph.       First	line	 indented.
			   .r		yes	no    Roman text follows.
.re	     -	     no    Reset tabs to default values.
.sc	     no      no    Read in  a  file  of  special  characters  and  diacritical	marks.	 Must  be  given  before  initialization.   .sh  n
			   x	  -	  yes	Section head follows, font automatically bold.	n is level of section, x is title of section.
.sk	     no      no    Leave the next page blank.  Only one page is remembered ahead.
.sz +n	     10p     no    Augment the point size by n points.
.th	     no      no    Produce the paper in thesis format.	Must be given before initialization.
.tp	     no      yes   Begin    title    page.    .u   x	     -	     no    Underline   argument   (even   in   *roff).	  (Nofill   only).
			   .uh		-	yes   Like .sh, but unnumbered.  .xp x	      -       no    Print index x.

Files
See Also
       refer(1), tbl(1), nroff(1)
       "-me Reference Manual", Supplementary Documents, Volume 1: General User
       "Writing Papers with Nroff Using -me", Supplementary Documents, Volume 1: General User

																	     me(7)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy