Sponsored Content
Top Forums Shell Programming and Scripting Multi-line filtering based on multi-line pattern in a file Post 302641637 by neutronscott on Wednesday 16th of May 2012 10:39:47 AM
Old 05-16-2012
awk works with records. you can separate by other delimiter than a newline. it's the RS variable.

Code:
$ awk 'BEGIN{RS=ORS="==========\n";FS="\n"}NF>2' input
RECORD 2
DATA LINE
==========
RECORD 4
DATA LINE
==========
RECORD 5
DATA LINE
==========

This User Gave Thanks to neutronscott For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multi line document to single lines based on occurance of string

Hi Guys, I am new to awk and sed, i am working multiline document, i want to make make that document into SINGLE lines based on occurace of string "dwh". here's the sample of my problem.. dwh123 2563 4562 4236 1236 78956 12394 4552 dwh192 2656 46536 231326 65652 6565 23262 16625623... (5 Replies)
Discussion started by: victor369
5 Replies

2. Shell Programming and Scripting

Search for a multi-line strings in a file

Hello I need to search for a mult-line strngs(with spaces in between and qoted) in a file1 and replace that text with Fixed string globally in file1. The strng to search for is in file2. The file is big with some 20K records. so speed and effciency is required file1: (where srch & rplc will... (7 Replies)
Discussion started by: Hiano
7 Replies

3. Shell Programming and Scripting

Print between multi line pattern

Hi, I have a file with text like this .SET WIDTH 10000 .SET MAXERROR 1 insert into new_db SELECT * FROM some_db ; +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+- .SET WIDTH 10000... (3 Replies)
Discussion started by: sol_nov
3 Replies

4. Shell Programming and Scripting

sed multiple multi line blocks of text containing pattern

Hi, I have a log file which has sessionids in it, each block in the log starts with a date entry, a block may be a single line or multiple lines. I need to sed (or awk) out the lines/blocks with that start with a date and include the session id. The files are large at several Gb. My... (3 Replies)
Discussion started by: andyatit
3 Replies

5. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

6. Shell Programming and Scripting

Multi line extraction based on condition

Hi I have some data in a file as below ****************************** Class 1A Students absent are : 1. ABC 2. CDE 3. CPE ****************************** Class 2A Students absent are : ****************************** Class 3A Students absent are : (6 Replies)
Discussion started by: reldb
6 Replies

7. Shell Programming and Scripting

How to find all the multi line pattern and redirecting it to a file?

I've a file like this {multi line ....... ....... pattern} { some other stuff ......... } {multi line ....... ....... pattern} { some other stuff ......... } and so on (2 Replies)
Discussion started by: aamir_raihan
2 Replies

8. Shell Programming and Scripting

Help with reformat single-line multi-fasta into multi-line multi-fasta

Input File: >Seq1 ASDADAFASFASFADGSDGFSDFSDFSDFSDFSDFSDFSDFSDFSDFSDFSD >Seq2 SDASDAQEQWEQeqAdfaasd >Seq3 ASDSALGHIUDFJANCAGPATHLACJHPAUTYNJKG ...... Desired Output File >Seq1 ASDADAFASF ASFADGSDGF SDFSDFSDFS DFSDFSDFSD FSDFSDFSDF SD >Seq2 (4 Replies)
Discussion started by: patrick87
4 Replies

9. Shell Programming and Scripting

Multi line log files to single line format

I want to read the log file which was generate from other command . And the output was having multi line in log files for job name and server name. But i need to make all the logs on one line Source file 07/15/2018 17:02:00 TRANSLOG_1700 Server0005_SQL ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

10. UNIX for Beginners Questions & Answers

Search a multi-line shell command output and execute logic based on result

The following is a multi-line shell command example: $cargo build Compiling prawn v0.1.0 (/Users/ag/rust/prawn) error: failed to resolve: could not find `setup_panix` in `human_panic` --> src/main.rs:14:22 | 14 | human_panic::setup_panix!(); | ... (2 Replies)
Discussion started by: yogi
2 Replies
BYZANZ-RECORD(1)					      General Commands Manual						  BYZANZ-RECORD(1)

NAME
byzanz-record - record your desktop session to an animated GIF SYNOPSIS
byzanz-record [options] FILENAME DESCRIPTION
Byzanz records your desktop session to an animated GIF. You can record your entire screen, a single window, or an arbitrary region. byzanz-record allows you to make recordings from the command line. Graphical users may want to use the panel applet instead. OPTIONS
Application Options: -d, --duration=SECS Duration of animation (default: 10 seconds) --delay=SECS Delay before start (default: 1 second) -c, --cursor Record mouse cursor -a, --audio Record audio from the default input device. This only works if the output format supports it and will otherwise cause an error. -x, --x=PIXEL X coordinate of rectangle to record -y, --y=PIXEL Y coordinate of rectangle to record -w, --width=PIXEL Width of recording rectangle -h, --height=PIXEL Height of recording rectangle -v, --verbose Be verbose --display=DISPLAY X display to use Help Options: -?, --help Show help options --help-gtk Show GTK+ Options --help-all Show all help options OUTPUT FILE
After byzanz-record is finished, the recording is written to FILENAME. The format is determined by the filename extension. The following formats are supported: gif Record to an animated GIF image. Use this if you want to record a mostly static screen with a limited amount of colors, such as using a file manager or an office application. This is the default and will be used if an unrecognized extension is used. ogg, ogv Record to an Ogg Theora video. This format supports audio. Use this if you want to record dynamic contents, such as video playback. flv Record to a Flash Screen video. This recording method is lossless. Use it if you want to postprocess the file in other applications. byzanz Record to Byzanz' internal debugging format. This is useful for benchmarking Byzanz or if you want to convert the recording to mul- tiple formats later. You can use byzanz-playback(1) to convert the file. SEE ALSO
byzanz-playback(1) AUTHOR
Byzanz was written by Benjamin Otte <otte@gnome.org>. This manual page was last updated for version 0.2.1. BYZANZ-RECORD(1)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy