Sponsored Content
Top Forums UNIX for Dummies Questions & Answers retrieve lines that match a pattern Post 302265964 by fadista on Tuesday 9th of December 2008 03:37:20 AM
Old 12-09-2008
retrieve lines that match a pattern

Hi,

I would like to know how can I get lines from a text file that match no more than 2 '>'. Example:

Input file:
a >cr1 4 a>b b>c
a >cr2 5 a>b

Output file:
a >cr2 5 a>b


Thanks in advance
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to delete lines do NOT match a pattern

On Unix, it is easy to get those lines that match a pattern, by grep pattern file or those lines that do not, by grep -v pattern file but I am editing a file on Windows with Ultraedit. Ultraedit support regular expression based search and replace. I can delete all the lines that match a... (1 Reply)
Discussion started by: JumboGeng
1 Replies

2. Shell Programming and Scripting

Match a pattern and copy above two lines

Dear experts, i want to search pattern tre and copy this line and above two lines in a seperate file:: Thanks for the help SEV="MAJOR": RX-TX HW-FAILURE DOMAIN="alcomc2_BSS_20 unit-type % bts nbr % 24 SBL-type % tre nbr % 4 subnb % 255 BR, Danish (16 Replies)
Discussion started by: Danish Shakil
16 Replies

3. Shell Programming and Scripting

Print lines before and after pattern match

I am using Solaris, I want to print 3 lines before pattern match pattern 5 lines after pattern match Pattern is abcd to be searched in a.txt. Looking for the solution in sed/awk/perl. Thanks .. Input File a.txt: ================= 1 2 3 abcd 4 5 6 7 8 (7 Replies)
Discussion started by: manuswami
7 Replies

4. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

5. Shell Programming and Scripting

Retrieve lines that match any occurence in a list of patterns

I have two files. The first containing a header and six columns of data. Example file 1: Number SNP ID dbSNP RS ID Chromosome Result_Call Physical Position 787066 SNP_A-8575395 RS6650104 1 NOCALL 564477 786872 SNP_A-8575125 RS10458597 1 AA ... (13 Replies)
Discussion started by: Selftaught
13 Replies

6. UNIX for Dummies Questions & Answers

Join the lines until next pattern match

Hi, I have a data file where data is splitted into multiple lines. And, each valid record starts with a patten date | <?xml and ends with pattern </dmm> e.g. 20120924|<?xml record 1 line1....record 1 line1....record 1 line1.... record 1 line2....record 1 line2....record 1 line2.... record 1... (3 Replies)
Discussion started by: Dipalik
3 Replies

7. Shell Programming and Scripting

Print lines that do not match the pattern

I need to print the lines that do not match a pattern. I tried using grep -v and sed -n '/pattern/!p', but both of them are not working as I am passing the pattern as variable and it can be null some times. Example ........ abcd...... .........abcd...... .........abcd......... (4 Replies)
Discussion started by: sunny1234
4 Replies

8. Shell Programming and Scripting

Extract lines that match a pattern

Hi all, I got a file that contains the following content, Actually it is a part of the file content, Installing XYZ XYZA Image, API 18, revision 2 Unzipping XYZ XYZA Image, API 18, revision 2 (1%) Unzipping XYZ XYZA Image, API 18, revision 2 (96%) Unzipping XYZ XYZA Image, API 18,... (7 Replies)
Discussion started by: Kashyap
7 Replies

9. Shell Programming and Scripting

Printing next 6 lines from of pattern match

Hi, i have a big file having many opcodes. if (opcode="01110000000100000000" ) then --fadd result.opcode := "01110000000100000000"; result.s0 := '1'; result.s1 := '1'; result.s2 := '0'; result.inst := '0'; result.scalar := '1';... (7 Replies)
Discussion started by: twistedpair
7 Replies

10. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
PPMNTSC(1)						      General Commands Manual							PPMNTSC(1)

NAME
ppmntsc - make a portable pixmap look like taken from an American TV SYNOPSIS
ppmntsc [ --pal ] [ --legalonly ] [ --illegalonly ] [ --correctedonly ] [ --verbose ] [ --debug ] [ infile ] Minimum unique abbreviations of options are acceptable. DESCRIPTION
This program makes colors legal in the NTSC (or PAL) color systems. Often, images generated on the computer are made for use in movies which ultimately end up on video tape. However, the range of colors (as specified by their RGB values) on a computer does not match the range of colors that can be represented using the NTSC (or PAL) systems. If an image with "illegal" colors is sent directly to an NTSC (or PAL) video system for recording, the "illegal" colors will be clipped. This may result in an undesirable looking picture. This utility tests each pixel in an image to see if it falls within the legal NTSC (or PAL) range. If not, it raises or lowers the pixel's saturation in the output so that it does fall within legal limits. Pixels that are already OK just go unmodified into the output. Input is from the file named input. If input is -, input is from Standard Input. If you don't specify input, input is from Standard Input. Output is always to Standard Output. This program handles multi-image PPM input, producing multi-image PPM output. OPTIONS
--pal Use the PAL transform instead of the default NTSC. --verbose Print a grand total of the number of illegal pixels. --debug Produce a humongous listing of illegal colors and their legal counterparts. NOTE: This option may produce a great deal of output. --legalonly Output only pixels that are already legal. Output black in place of pixels that are not. --illegalonly Output only pixels that are illegal (and output them uncorrected). Output black in place of pixels that are already legal. --correctedonly Output only pixels that are corrected versions of illegal pixels. Output black in place of pixels that are already legal. SEE ALSO
ppm(5), ppmdepth(1), ppmdim(1), ppmbrighten(1) AUTHOR
Wes Barris, Minnesota Supercomputer Center, Inc., Bryan Henderson 4th Berkeley Distribution April 19, 2000 PPMNTSC(1)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy