Sponsored Content
Top Forums Shell Programming and Scripting Use string as Record separator in awk Post 302947642 by cgkmal on Friday 19th of June 2015 06:20:17 PM
Old 06-19-2015
Hello Scrutinizer,

Thanks for your reply.

I've tried your solution but I only receive the first record and if I try to print the first field for all records (28, 29 and 30), I only receive the first one (28). The same if I try to print the 2nd field(the dates) I onle receive the first date.

like this:
Code:
gawk 'BEGIN{ORS=""; RS="No.     Time[^\n]*\n"} NR==2 {print $1}' file
28

The output should be:
Code:
28
29
30

Thanks again for the help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

record separator

can anyone tell me any way to change record separator (default is new line). RS in nawk as not working. Thanks in advance. Regards Rochit (7 Replies)
Discussion started by: rochitsharma
7 Replies

2. Shell Programming and Scripting

awk & cut record separator problem

Hi All, I've got some strange behaviour going on when trying to manipulate a file that contains spaces. My input file looks something like this: xxxxxxxxx,yyyy,sss sss sss,bbbbbbb If I use awk: When running from the command line I get: sss sss sss But when running from a... (7 Replies)
Discussion started by: pondlife
7 Replies

3. Shell Programming and Scripting

How to add record separator after certain lines

How to add record separator after certain lines? I am faicing issue where some lines have result as successive line & some are not having. how can I add record separator after every record here is example of data I have (line numbers are not present in data): 1. <enabled="true" name="dSuite1"... (7 Replies)
Discussion started by: sach253
7 Replies

4. Shell Programming and Scripting

awk - double quotes as record separator

How do I use double quotes as a record seperator in awk? (4 Replies)
Discussion started by: locoroco
4 Replies

5. Shell Programming and Scripting

Using > as record separator

I have tried to use ">" as record separator, but it doesn't work. I have tried this: awk BEGIN{RS=">"}'{print $0}' input output: awk: BEGIN{RS=>}{print $0} awk: ^ syntax error awk BEGIN{RS="\>"}'{print $0}' input awk: BEGIN{RS=\>}{print $0} awk: ^ backslash not... (2 Replies)
Discussion started by: locoroco
2 Replies

6. Shell Programming and Scripting

awk, string as record separator, transposing rows into columns

I'm working on a different stage of a project that someone helped me address elsewhere in these threads. The .docs I'm cycling through look roughly like this: 1 of 26 DOCUMENTS Copyright 2010 The Age Company Limited All Rights Reserved The Age (Melbourne, Australia) November 27, 2010... (9 Replies)
Discussion started by: spindoctor
9 Replies

7. Shell Programming and Scripting

apply record separator to multiple files within a directory using awk

Hi, I have a bunch of records within a directory where each one has this form: (example file1) 1 2 50 90 80 90 43512 98 0909 79869 -9 7878 33222 8787 9090 89898 7878 8989 7878 6767 89 89 78676 9898 000 7878 5656 5454 5454 and i want for all of these files to be... (3 Replies)
Discussion started by: amarn
3 Replies

8. Shell Programming and Scripting

awk - single quotes as record separator

How do I use single quotes as record separator in awk? I just couldn't figure that out. I know how to use single quotes as field separator, and double quotes as both field and record separator ... (1 Reply)
Discussion started by: locoroco
1 Replies

9. Shell Programming and Scripting

Replace a string for every record after the 1st record

I have data coming in the below format for each record <?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox> <?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies

10. Shell Programming and Scripting

Help with awk regular expression for RS record separator

Hi, I'm using gawk to read a text file and count the sentences. I want to use a record separator of a period, exclamation mark and a question mark. The problem is that the file contains words like "Mr. Smith" so the periods in the appellation are tripping my record separator. This is my... (12 Replies)
Discussion started by: 1Brajesh
12 Replies
XpInputSelected(3Xp)						 XPRINT FUNCTIONS					      XpInputSelected(3Xp)

NAME
XpInputSelected - Queries which X Print events the client has selected to receive from the specific print context. SYNOPSIS
cc [ flag... ] file... -lXp [ library... ] #include <X11/extensions/Print.h> unsigned long XpInputSelected ( display, context, event_mask ) Display *display; XPContext context; unsigned long *all_event_mask_return; ARGUMENTS
display Specifies a pointer to the Display structure; returned from XOpenDisplay. context Specifies the print context to which the query is being made. all_event_mask_return Returns the set of events that any client has selected. DESCRIPTION
XpInputSelected returns a bit mask describing which event classes the client has selected to receive. The value returned to all_event_mask_return is the union of every client's event mask. XpInputSelected queries which X Print events from the specified print context the client has selected to receive. The X Print Events are generated from a print context, and not from a window as is the case with XSelectInput. As events arrive, the context field in the event is used to determine which print context generated the event. See XpS- electInput for the event_mask and all_event_mask (??return??) values. DIAGNOSTICS
XPBadContext The specified print context is not valid. SEE ALSO
XpSelectInput(3Xp) X Version 11 libXp 1.0.0 XpInputSelected(3Xp)
All times are GMT -4. The time now is 01:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy