Sponsored Content
Top Forums Shell Programming and Scripting Print/delete the lines between two pattern. Post 302676711 by Chirel on Wednesday 25th of July 2012 04:42:58 AM
Old 07-25-2012
Hi

To get rbe.data
Code:
awk '/^[A-Z]/ { k=match($1,/RBE/); } { if (k) print; }' nastran1.bdf >rbe.data

To generate new.nastran1.bdf and rbe.data
Code:
awk '/^[A-Z]/ { k=match($1,/RBE/); } { if (k) print >"rbe.data"; else print >"new.nastran1.bdf"; }' nastran1.bdf

 

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

SED: delete and print the only exact matched pattern

I am really need help with the regular expression in SED. From input file, I need to extract lines that have the port number (sport or dport) as defined. The input file is something like this time=1209515280-1209515340 dst=192.168.133.202 src=208.70.8.23 bytes=2472 proto=6 sport=80 dport=1447... (6 Replies)
Discussion started by: new_buddy
6 Replies

3. Shell Programming and Scripting

Sed to delete exactly match pattern and print them in other file

Hi there, I need help about using sed. Iam using sed to delete and print lines that match the port number as listed in sedfile. I am using -d and -p command for delete match port and print them respectively. However, the output is not synchonize where the total deleted lines is not similar with... (3 Replies)
Discussion started by: new_buddy
3 Replies

4. Shell Programming and Scripting

Delete Lines between the pattern

Hi All, Below is my requirement. Whatever coming in between ' ', needs to delete. Input File Contents: ============== This is nice 'boy' This 'is bad boy.' Got it Expected Output =========== This is nice This Got it (4 Replies)
Discussion started by: susau_79
4 Replies

5. Shell Programming and Scripting

sed pattern to delete lines containing a pattern, except the first occurance

Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows. header for file 1111 2222 3333 header for file 1111 2222 3333 header for file... (8 Replies)
Discussion started by: gary_w
8 Replies

6. Shell Programming and Scripting

print lines up to pattern excluding pattern

11 22 33 44 55 66 77 When pattern 55 is met, print upto it, so output is 11 22 33 44 (1 Reply)
Discussion started by: anilcliff
1 Replies

7. 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

8. 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

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. Shell Programming and Scripting

How to delete all lines before a particular pattern when the pattern is defined in a variable?

I have a file Line 1 a Line 22 Line 33 Line 1 b Line 22 Line 1 c Line 4 Line 5 I want to delete all lines before last occurrence of a line which contains something which is defined in a variable. Say a variable var contains 'Line 1', then I need the following in the output. ... (21 Replies)
Discussion started by: Soham
21 Replies
QSTAIL(1)							  qstail man page							 QSTAIL(1)

NAME
qstail - Utility prints the end of a log file starting at the specified pattern. SYNOPSIS
qstail -i <path> -p <pattern> DESCRIPTION
qstail shows the end of a log file beginning with the line containing the specified pattern. This may be used to show all lines which has been written after a certain event (e.g., server restart) or time stamp. OPTIONS
-i <path> Input file to read the data from. -p <pattern> Search pattern (literal string). SEE ALSO
qsexec(1), qsfilter2(1), qsgeo(1), qsgrep(1), qslog(1), qslogger(1), qspng(1), qsrotate(1), qssign(1) AUTHOR
Pascal Buchbinder, http://opensource.adnovum.ch/mod_qos/ mod_qos utilities 10.8 June 2012 QSTAIL(1)
All times are GMT -4. The time now is 07:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy