Sponsored Content
Top Forums Shell Programming and Scripting How to remove text between two expressions Post 302565672 by vgersh99 on Tuesday 18th of October 2011 12:53:40 PM
Old 10-18-2011
Quote:
Originally Posted by deneuve01
Thank you ! I think that took care of everything but the 'End' line.
Code:
nawk '/^Begin/ {print $1,$2, "Datetime [" $(NF-3) " " $(NF-2) "],", $(NF-1) " [" $NF "]";next}$1 ~ /Insert|Update|Delete/ {$0=$1 OFS $2 OFS $(NF-1) OFS $NF}$1~/End/ {$0=$1 OFS $2 OFS "Datetime [" $(NF-1) " " $NF}1' OFS='\t' myFile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove duplicate text

Hello, I have a log file which is generated by a script which looks like this: userid: 7 starttime: Sat May 24 23:24:13 CEST 2008 endtime: Sat May 24 23:26:57 CEST 2008 total time spent: 2.73072 minutes / 163.843 seconds date: Sat Jun 7 16:09:03 CEST 2008 userid: 8 starttime: Sun May... (7 Replies)
Discussion started by: dejavu88
7 Replies

2. Shell Programming and Scripting

remove specified text from file

I am trying to write a script that kills old sessions, I've posted here over the past few days and the script is just about perfect except I want to be given the option to exclude specified PIDs from being killed. this is the entire script: if then rm /tmp/idlepids fi if then rm... (2 Replies)
Discussion started by: raidzero
2 Replies

3. Shell Programming and Scripting

How to extract text from string using regular expressions

Hi, I'm trying to use sed to extract some text and assign it to a variable. Can anyone provide me with some help? it would be much appreciated! I"m looking to extract for example: filename=/output/R34/2005_13_R34_C1042S_T83_CRFTXT_20081015.txt I'm trying to extract the 1042... (9 Replies)
Discussion started by: jtung
9 Replies

4. UNIX for Dummies Questions & Answers

Remove text in line

Hi, i have a text file with some links and i want to remove some characters from it. My text file is something like this: <p> <b> Arquivo CASC2270.09o transferido com sucesso. </b> </p><p> <b> Verificando CASC2270.09o ... </b> </p><p> <b> Iniciando processamento de CASC2270.09o ... </b>... (11 Replies)
Discussion started by: limadario
11 Replies

5. Shell Programming and Scripting

remove specified line from text

hi, I wish to move a specified line from a text file: ltoremove=5 #remove 5th line i=1 while read line ; do if ; then ... i=$(($i+1)) done < "txt.txt" how should this actually be done? is there a shorter faster way to do this? :wall: Thanks, Ted (2 Replies)
Discussion started by: ted_chou12
2 Replies

6. Shell Programming and Scripting

Remove characters from text

I have a file which looks like this. I only show first 11 lines of the file followed by some text that appears at the end of every file. 1. file:///path1/path2/path3/path4/251192.dat (score 3.849384, docid 142923) 2. file:///path1/path2/path3/path4/173859.dat (score 3.831033, docid 75365) 3.... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

7. Shell Programming and Scripting

Remove text between brackets

How can I use bash to remove all text between "<" and ">" in a file? (1 Reply)
Discussion started by: locoroco
1 Replies

8. Shell Programming and Scripting

Remove ending text

Hello, I am working with a list that contains a large number of files listed by their absolute path. I am trying to determine a way to delete the file name at the end of each line, therefore leaving just the directory path. For example, I'd like to go from: /home/something/file... (2 Replies)
Discussion started by: omnivir
2 Replies

9. Shell Programming and Scripting

Bash script - coloring reg. expressions in text

Hi all, is there anyone good at bash who will help me? I need to use syntax ${string/pattern/replacement} The problematic part where I am stuck is: #!bin/bash text="A cat is on a mat." exp="cat" newexp="SOMECODEcatSOMECODE" newtext=${${text}/${exp}/${newexp}} == > ERROR "wrong... (4 Replies)
Discussion started by: JohnnyM77
4 Replies

10. Shell Programming and Scripting

How to remove the text between all curly brackets from text file?

Hello experts, I have a text file with lot of curly brackets (both opening { & closing } ). I need to delete them alongwith the text between opening & closing brackets' pair. For ex: Input:- 59. Rh1 Qe4 {(Qf5-e4 Qd8-g8+ Kg6-f5 Qg8-h7+ Kf5-e5 Qh7-e7+ Ke5-f5 Qe7-d7+ Qe4-e6 Qd7-h7+ Qe6-g6... (6 Replies)
Discussion started by: prvnrk
6 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 08:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy