Sponsored Content
Top Forums Shell Programming and Scripting How to extract entire stanza using awk? Post 303023014 by vgersh99 on Monday 10th of September 2018 12:56:14 PM
Old 09-10-2018
how about:
Code:
awk '/^[[]Event/ {e=$0;next} /O-O-O/ {print e ORS $0}' RS= ORS='\n\n' myFile

This User Gave Thanks to vgersh99 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting the stanza names if the pattern found

Hi Friends, I have a file as below : machine1: abc xyz qwerty machine2: jkl mno machine3: hhh kkk qwerty Now ...i need to find all the stanza names that have the pattern "qwerty'" in it...( i need to get the output as machine1 and machine3 since... (4 Replies)
Discussion started by: vijaya2006
4 Replies

2. Shell Programming and Scripting

selecting the stanza fields

Hi Friends, I have a stanza file as below : CuDv: name = "hdisk34" status = 0 chgstatus = 3 ddins = "scsidisk" location = "06-08-02" parent = "fscsi0" connwhere = "W_0" PdDvLn = "disk/fcp/mpioosdisk" CuDv: ... (1 Reply)
Discussion started by: vijaya2006
1 Replies

3. Shell Programming and Scripting

Script required to extract a specific snippet from the entire file.

Hi, I have a file with the following structure. XXXXX........... YYYYY........... ................. .................. ZZZZZZ...... qwerty_start.............. .................. ................. .................. querty_end................ .............................. (1 Reply)
Discussion started by: abinash
1 Replies

4. Shell Programming and Scripting

Printing entire field, if at least one row is matching by AWK

Dear all, I have been trying to print an entire field, if the first line of the field is matching. For example, my input looks something like this. aaa ddd zzz 123 987 126 24 0.650 985 354 9864 0.32 0.333 4324 000 I am looking for a pattern,... (5 Replies)
Discussion started by: Chulamakuri
5 Replies

5. Shell Programming and Scripting

awk if statement not printing entire field

I have an input that looks like this: chr1 mm9_knownGene utr3 3204563 3206102 0 - . gene_id "Xkr4"; transcript_id "uc007aeu.1"; chr1 mm9_knownGene utr3 4280927 4283061 0 - . gene_id "Rp1"; transcript_id "uc007aew.1"; chr1 mm9_knownGene ... (5 Replies)
Discussion started by: pbluescript
5 Replies

6. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

7. Shell Programming and Scripting

awk sum entire string

Hi I am trying to carry out a sum on a file (totals.txt). The file looks like: So far i have this command this returns 20610 I however want it to return 000000206100 Any help would be great thanks! (6 Replies)
Discussion started by: nwalsh88
6 Replies

8. UNIX for Dummies Questions & Answers

Using awk to find max and printing entire line

Hi folks, I am very new to awk. I have what is probably a very simple question. I'm trying to get the max value of column 1, but also print column 2. My data looks like this: 0.044|2000-02-03 14:00:00 5.23|2000-02-03 05:45:00 5.26|2000-02-03 11:15:00 0|2000-02-01 18:30:00 So in this case... (2 Replies)
Discussion started by: amandarobe
2 Replies

9. AIX

Fsize in default: stanza.

The default: stanza in /etc/security/limits is still set to 2097151 on fsize (max file size). I know tar had issues with large files but is there any other reasons for it? I'm thinking yes since it's still set to that by IBM. Cheers, DH (4 Replies)
Discussion started by: Devyn
4 Replies

10. Shell Programming and Scripting

How to extract entire para instead of just line?

Hello, I have a file with multiple paragraphs/sections each starting with word "Handle" and if I grep for a pattern, I should get contents of entire section/para (not just line). Please advise, thanks! #script.sh file.txt "System Information" Handle 0x0001 DMI type 1, 27 bytes. ... (9 Replies)
Discussion started by: reddyr
9 Replies
Perl6::Say(3pm) 					User Contributed Perl Documentation					   Perl6::Say(3pm)

NAME
Perl6::Say - "print" -- but no newline needed SYNOPSIS
# Perl 5 code... use Perl6::Say; say 'boo'; # same as: print 'boo', " " say STDERR 'boo'; # same as: print STDERR 'boo', " " STDERR->say('boo'); # same as: print STDERR 'boo', " $fh->say('boo'); # same as: print $fh 'boo', " "; say(); # same as: print "$_ "; say undef; # same as: print " "; DESCRIPTION
Note for Users of Perl 5.10 You don't need this module. The Perl 6 "say" function is available in Perl 5.10 by saying "use feature 'say';". Hence, this module is of interest only to users of Perl 5.6 and 5.8. If you have Perl 5.10 installed, see the 510/ directory in this distribution for some elementary examples of "say" taken from "perldoc fea- ture". General Implements a close simulation of the "say" function in Perl 6, which acts like "print" but automatically appends a newline. Use it just like "print" (except that it only supports the indirect object syntax when the stream is a bareword). That is, assuming the relevant filehandles are open for output, you can use any of these: say @data; say FH @data; FH->say(@data); *FH->say(@data); (*FH)->say(@data); say $fh, @data; $fh->say(@data); but not any of these: say {FH} @data; say {*FH} @data; say {*FH} @data; say $fh @data; say {$fh} @data; Additional Permitted Usages As demonstrated in the test suite accompanying this distribution, "Perl6::Say::say()" can be used in all the following situations. $string = q{}; open FH, ">", $string; say FH qq{Hello World}; # print to a string close FH; # requires Perl 5.8.0 or later use FileHandle; $fh = FileHandle->new($file, 'w'); if (defined $fh) { say $fh, qq{Hello World}; $fh->close; } use IO::File; $fh = IO::File->new($file, 'w'); if (defined $fh) { say $fh, qq{Hello World}; $fh->close; } $string = q{}; open FH, ">", $string; # requires Perl 5.8.0 or later select(FH); say qq{Hello World}; close FH; Interaction with Output Record Separator In Perl 6, "say @stuff" is exactly equivalent to "Core::print @stuff, " "". That means that a call to "say" appends any output record separator (ORS) after the added newline (though in Perl 6, the ORS is an attribute of the filehandle being used, rather than a global $/ variable). "IO::Handle::say()" IO::Handle version 1.27 or later (which, confusingly, is found in IO distribution 1.23 and later) also implements a "say" method. Perl6::Say provides its own "say" method to IO::Handle if "IO::Handle::say" is not available. Usage with Older Perls As noted above, some aspects of "Perl6::Say::say()" will not work with versions of Perl earlier than 5.8.0. This is not due to any problem with this module; it is simply that Perl did not support printing to an in-memory file ("print $string, " ";") prior to that point. (Thanks to a CPAN testers report from David Cantrell for identifying this limitation.) WARNING
The syntax and semantics of Perl 6 is still being finalized and consequently is at any time subject to change. That means the same caveat applies to this module. DEPENDENCIES
No dependencies other than on modules included with the Perl core as of version 5.8.0. Some of the files in the test suite accompanying this distribution use non-core CPAN module IO::Capture::Stdout. Tests calling IO::Cap- ture::Stdout methods are enclosed in "SKIP" blocks and so should pose no obstacle to installation of the distribution on systems lacking IO::Capture. (However, the maintainer strongly recommends IO::Capture for developers who write a lot of test code. So please consider installing it!) AUTHOR and MAINTAINER AUTHOR Damian Conway (damian@conway.org). MAINTAINER James E Keenan (jkeenan@cpan.org) (effective v0.06, July 2006). ACKNOWLEDGMENTS
Thanks to Damian Conway for dreaming this up. Thanks to David A Golden for a close review of the documentation. Thanks to CPAN tester Jost Krieger for reporting an error in my SKIP block count in one test file. BUGS AND IRRITATIONS
As far as we can determine, Perl 5 doesn't allow us to create a subroutine that truly acts like "print". That is, one that can simultane- ously be used like so: say @data; and like so: say {$fh} @data; Comments, suggestions, and patches welcome. COPYRIGHT
Copyright (c) 2004, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.8.8 2008-02-09 Perl6::Say(3pm)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy