Sponsored Content
Top Forums Shell Programming and Scripting How to print only lines in between two strings using awk Post 302156353 by jisha on Tuesday 8th of January 2008 12:16:31 AM
Old 01-08-2008
How to print only lines in between two strings using awk

Hi,

I want to print only lines in between two strings and not the strings using awk.

Eg:
OUTPUT
top 2
bottom 1
left 0
right 0
page 66
END
I want to print into a new file only
top 2
bottom 1
left 0
right 0
page 66

Thanks in Advance
JS
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using AWK see the upper lines and lower lines of the strings??

Hi experts, You cool guys already given me the awk script below- awk '/9366109380/,printed==5 { ++printed; print; }' 2008-09-14.0.log Morever, i have one more things- when i awk 9366109380, i can also see the Upper 3 lines as well as below 5 lines of that string. Line 1.... (3 Replies)
Discussion started by: thepurple
3 Replies

2. Shell Programming and Scripting

Print all the lines between 2 specified strings

Hi All, I have a file in which i want to print all the lines between 2 defined strings. Ex- I have file with data as follows STEP1:- ----- has some 20 -30 lines of data STEP2:- ----- has some 20 -30 lines of data So i want to print those lines between STEP1 & STEP2. (line including STEP1)... (7 Replies)
Discussion started by: digitalrg
7 Replies

3. Shell Programming and Scripting

Compare two strings, and print lines containing mismatches

pls help me on this... and im really sorry because i really don't know where to start here... FILE1 ABC DEF 10 2 DEF GHI 11 3 GHI JKL 12 5 JKL MNO 13 7 MNO PQR 14 5 requirements: 1. The third string should only be 10 or 12 2. The fourth string should only be 2 or 3 3. Prinnt... (1 Reply)
Discussion started by: kingpeejay
1 Replies

4. Shell Programming and Scripting

perl or awk print strings between words

hi everyone, 1.txt 981 I field1 > field2.a: aa, ..si01To:<f:a@a.com>From: <f:a@a.com>;tag=DVNgfRZBZRMi96 <f:a@1:333>;ZZZZZ: 12345 the output field1 field2 <f:a@a.com> the output is cut the string 3rd and 5th field, and get the value betwee "To:" and "From:", please advice. ... (1 Reply)
Discussion started by: jimmy_y
1 Replies

5. Shell Programming and Scripting

Print lines between two strings multiple occurencies (with sed, awk, or grep)

Hello, I can extract lines in a file, between two strings but only one time. If there are multiple occurencies, my command show only one block. Example, monfichier.txt contains : debut_sect texte L1 texte L2 texte L3 texte L4 fin_sect donnees inutiles 1 donnees inutiles 2 ... (8 Replies)
Discussion started by: theclem35
8 Replies

6. Shell Programming and Scripting

Print strings that match pattern with awk

I have a file with many lines which contain strings like .. etc. But with no rule regarding field separators or anything else. I want to print ONLY THE STRING from each line , not the entire line !!! For example from the lines : Flow on service executed with success in . Performances... (5 Replies)
Discussion started by: black_fender
5 Replies

7. Shell Programming and Scripting

Print only lines where fields concatenated match strings

Hello everyone, Maybe somebody could help me with an awk script. I have this input (field separator is comma ","): 547894982,M|N|J,U|Q|P,98,101,0,1,1 234900027,M|N|J,U|Q|P,98,101,0,1,1 234900023,M|N|J,U|Q|P,98,54,3,1,1 234900028,M|H|J,S|Q|P,98,101,0,1,1 234900030,M|N|J,U|F|P,98,101,0,1,1... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

8. Shell Programming and Scripting

Print lines between strings like *0123456*

I have a text file contains *02638650* SAMBO 1 Spouse SAMBO FELIX *01591453* MADUAGUGBUO 4 Child3 MADUAGUGBUO JOY *01488523* ANYIAM 1 Spouse ANYIAM FRANCA 2 Child1 ANYIAM GRACE *01647769* EGWUTUOHA 0 Principal ... (6 Replies)
Discussion started by: ktsis
6 Replies

9. UNIX for Dummies Questions & Answers

awk - (URGENT!) Print lines sort and move lines if match found

URGENT HELP IS NEEDED!! I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. - Also the matching lines are not moving out of File1.txt ... (1 Reply)
Discussion started by: High-T
1 Replies

10. UNIX for Beginners Questions & Answers

How to use awk to print strings with anchors?

I have a list of countries and I'm trying to print the country names that start with "A" and end in "a". I can do the first one which gives me the correct output. awk '/^A/ {print $1}' countries.txt but when I try: awk '/^A a$/ {print $1}' countries.txt or even: awk... (2 Replies)
Discussion started by: steezuschrist96
2 Replies
pnmcrop(1)						      General Commands Manual							pnmcrop(1)

NAME
pnmcrop - crop a portable anymap SYNOPSIS
pnmcrop [-white|-black|-sides] [-left] [-right] [-top] [-bottom] [pnmfile] All options may be abbreviated to their shortest unique prefix or specified with double hyphens. DESCRIPTION
Reads a PBM, PGM, or PPM image as input. Removes borders that are the background color, and produces the same type of image as output. If you don't specify otherwise, pnmcrop assumes the background color is whatever color the top left and right corners of the image are and if they are different colors, something midway between them. You can specify that the background is white or black with the -white and -black options or make pnmcrop base its guess on all four corners instead of just two with -sides. By default, pnmcrop chops off any stripe of background color it finds, on all four sides. You can tell pnmcrop to remove only specific borders with the -left, -right, -top, and -bottom options. If you want to chop a specific amount off the side of an image, use pnmcut. If you want to add different borders after removing the existing ones, use pnmcat or pnmcomp. OPTIONS
-white Take white to be the background color. pnmcrop removes borders which are white. -black Take black to be the background color. pnmcrop removes borders which are black. -sides Determine the background color from the colors of the four corners of the input image. pnmcrop removes borders which are of the background color. If at least three of the four corners are the same color, pnmcrop takes that as the background color. If not, pnmcrop looks for two corners of the same color in the following order, taking the first found as the background color: top, left, right, bottom. If all four corners are different colors, pnmcrop assumes an average of the four colors as the background color. The -sides option slows pnmcrop down, as it reads the entire image to determine the background color in addition to the up to three times that it would read it without -sides. -left Remove any left border. -right Remove any right border. -top Remove any top border. -bottom Remove any bottom border. -verbose Print on Standard Error information about the processing, including exactly how much is being cropped off of which sides. SEE ALSO
pnmcut(1), pnmfile(1), pnm(5) AUTHOR
Copyright (C) 1989 by Jef Poskanzer. 18 March 2001 pnmcrop(1)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy