Sponsored Content
Top Forums Shell Programming and Scripting Transpose multi-line records into a single row Post 302531445 by daveyabe on Thursday 16th of June 2011 07:50:24 PM
Old 06-16-2011
Ahhhh yes an NF loop! That's what I was trying to think of, thanks mirni!

The previous reply with a function IF statement did not return the desired results but looks like a good effort....even if I cannot interpret it at all =)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK Multi-Line Records Processing

I am an Awk newbie and cannot wrap my brain around my problem: Given multi-line records of varying lengths separated by a blank line I need to skip the first two lines of every record and extract every-other line in each record unless the first line of the record has the word "(CONT)" in the... (10 Replies)
Discussion started by: RacerX
10 Replies

2. Shell Programming and Scripting

How to use Perl to merge multi-line into single line

Hi, Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line. ******Org. Multi-line) BAM admin 101.203.57.22 ... (3 Replies)
Discussion started by: happyday
3 Replies

3. Shell Programming and Scripting

Capturing multi-line records containing known value?

Some records in a file look like this, with any number of lines between start and end flags: /Start Some stuff Banana 1 Some more stuff End/ /Start Some stuff End/ /Start Some stuff Some more stuff Banana 2 End/ ...how would I process this file to find records containing the... (8 Replies)
Discussion started by: cs03dmj
8 Replies

4. UNIX for Dummies Questions & Answers

Alphabetical sort for multi line records contains in a single file

Hi all, I So, I've got a monster text document comprising a list of various company names and associated info just in a long list one after another. I need to sort them alphabetically by name... The text document looks like this: Company Name: the_first_company's_name_here Address:... (2 Replies)
Discussion started by: quee1763
2 Replies

5. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

6. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

7. UNIX for Dummies Questions & Answers

Remove multi line and single line comments

Hi, I am trying to remove multi line and single line comments like examples below I have tried this pattern. it works fine for single line comments and multi line comments in a single line only. but this fails when the comments are extended in multiple lines as shown in the comment 2 of... (3 Replies)
Discussion started by: ahmedwaseem2000
3 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

Combine multi-row cell into a single line

My CSV file looks similar to this example (the K, L, and M are in the same cell as J but each on a new line within that cell): 1, A, B, C, D 2, E, F, G, H 3, I, J N, O, K L M, 4, P, Q, R, S I would like to have it look like this: 1, A,... (6 Replies)
Discussion started by: Kim Ashby
6 Replies
xcb-requests(3) 						   XCB examples 						   xcb-requests(3)

NAME
xcb-requests - about request manpages DESCRIPTION
Every request in X11, like MapWindow, corresponds to a number of functions and data structures in XCB. For MapWindow, XCB provides the function xcb_map_window, which fills the xcb_map_window_request_t data structure and writes that to the X11 connection. Since the MapWindow request does not have a reply, this is the most simple case. REPLIES
Many requests have replies. For each reply, XCB provides at least a corresponding data structure and a function to return a pointer to a filled data structure. Let's take the InternAtom request as an example: XCB provides the xcb_intern_atom_reply_t data structure and xcb_intern_atom_reply function. For replies which are more complex (for example lists, such as in xcb_list_fonts), accessor functions are provided. COOKIES
XCB returns a cookie for each request you send. This is an XCB-specific data structure containing the sequence number with which the request was sent to the X11 server. To get any reply, you have to provide that cookie (so that XCB knows which of the waiting replies you want). Here is an example to illustrate the use of cookies: void my_example(xcb_connection *conn) { xcb_intern_atom_cookie_t cookie; xcb_intern_atom_reply_t *reply; cookie = xcb_intern_atom(conn, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME"); /* ... do other work here if possible ... */ if ((reply = xcb_intern_atom_reply(conn, cookie, NULL))) { printf("The _NET_WM_NAME atom has ID %u0, reply->atom); } free(reply); } CHECKED VS. UNCHECKED The checked and unchecked suffixes for functions determine which kind of error handling is used for this specific request. For requests which have no reply (for example xcb_map_window), errors will be delivered to the event loop (you will receive an X11 event of type 0 when calling xcb_poll_for_event). If you want to explicitly check for errors in a blocking fashion, call the _checked version of the function (for example xcb_map_window_checked) and use xcb_request_check. For requests which have a reply (for example xcb_intern_atom), errors will be checked when calling the reply function. To get errors in the event loop instead, use the _unchecked version of the function (for example xcb_intern_atom_unchecked). Here is an example which illustrates the four different ways of handling errors: /* * Request without a reply, handling errors in the event loop (default) * */ void my_example(xcb_connection *conn, xcb_window_t window) { /* This is a request without a reply. Errors will be delivered to the event * loop. Getting an error to xcb_map_window most likely is a bug in our * program, so we don't need to check for that in a blocking way. */ xcb_map_window(conn, window); /* ... of course your event loop would not be in the same function ... */ while ((event = xcb_wait_for_event(conn)) != NULL) { if (event->response_type == 0) { fprintf("Received X11 error %d ", error->error_code); free(event); continue; } /* ... handle a normal event ... */ } } /* * Request without a reply, handling errors directly * */ void my_example(xcb_connection *conn, xcb_window_t deco, xcb_window_t window) { /* A reparenting window manager wants to know whether a new window was * successfully reparented. If not (because the window got destroyed * already, for example), it does not make sense to map an empty window * decoration at all, so we need to know this right now. */ xcb_void_cookie_t cookie = xcb_reparent_window_checked(conn, window, deco, 0, 0); xcb_generic_error_t *error; if ((error = xcb_request_check(conn, cookie))) { fprintf(stderr, "Could not reparent the window "); free(error); return; } /* ... do window manager stuff here ... */ } /* * Request with a reply, handling errors directly (default) * */ void my_example(xcb_connection *conn, xcb_window_t window) { xcb_intern_atom_cookie_t cookie; xcb_intern_atom_reply_t *reply; xcb_generic_error_t *error; cookie = xcb_intern_atom(c, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME"); /* ... do other work here if possible ... */ if ((reply = xcb_intern_atom_reply(c, cookie, &error))) { printf("The _NET_WM_NAME atom has ID %u0, reply->atom); free(reply); } else { fprintf(stderr, "X11 Error %d ", error->error_code); free(error); } } /* * Request with a reply, handling errors in the event loop * */ void my_example(xcb_connection *conn, xcb_window_t window) { xcb_intern_atom_cookie_t cookie; xcb_intern_atom_reply_t *reply; cookie = xcb_intern_atom_unchecked(c, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME"); /* ... do other work here if possible ... */ if ((reply = xcb_intern_atom_reply(c, cookie, NULL))) { printf("The _NET_WM_NAME atom has ID %u0, reply->atom); free(reply); } /* ... of course your event loop would not be in the same function ... */ while ((event = xcb_wait_for_event(conn)) != NULL) { if (event->response_type == 0) { fprintf("Received X11 error %d ", error->error_code); free(event); continue; } /* ... handle a normal event ... */ } } SEE ALSO
xcb_map_window(3), xcb_intern_atom(3), xcb_list_fonts(3), xcb_poll_for_event(3), xcb_request_check(3) AUTHOR
Michael Stapelberg <michael+xcb at stapelberg dot de> XCB
2011-12-11 xcb-requests(3)
All times are GMT -4. The time now is 05:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy