How to extract entire stanza using awk?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to extract entire stanza using awk?
# 8  
Old 09-23-2018
Quote:
Originally Posted by RudiC
How are those files created?
These files denote chess games and are called PGN (portable game notation).

Quote:
Originally Posted by prvnrk
I find it extremely hard to learn awk and is highly confusing.
awk is a complete programming language, but its main design goal was to work on table-based data. Each awk-program has three sections:

- one section (BEGIN) is executed before any data are read - think about printing a header

- one is executed for each line of the input data and consists of rules. A "rule" basically is a list of commands and a description of a text pattern: if the line matches the text pattern the commands are executed, if not then not

- one section (END) is executed after all data in the input file/data stream is processed - think of writing a footer and eventually totals, etc..

In my opinion the best book about awk (and sed - they have a lot in common) is "awk & sed" by Dale Dougherty, published by O'Reilly.

I hope this helps.

bakunin
# 9  
Old 09-24-2018
I have that book, it's name is sed & awk and I also found it to be an excellent primer.

The symbol he is looking for represents Queenside Castling.

If you need to create a diagram from a point in a PGN file, this tool can help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
Login or Register to Ask a Question