Sponsored Content
Top Forums UNIX for Dummies Questions & Answers replacing space with pipe(delimiter) Post 302287927 by OSD on Monday 16th of February 2009 03:38:33 AM
Old 02-16-2009
hey, it works.
Thank you so much. This has been so informative. thanks a zillion. You rockSmilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cutting a portion of a line seperated by pipe delimiter

Hi, In the below line a|b|10065353|tefe|rhraqs|135364|5347575 dgd|rg|4333|fhra|grhrt|46423|urdsgd Here i want to cut the characters in between the second and third pipe delimiter and then between fifth and sixth delimiter and retain the rest of the line. My output should be ... (3 Replies)
Discussion started by: ragavhere
3 Replies

2. Shell Programming and Scripting

comma delimiter and space

I have a csv file and there is a problem which I need to resolve. Column1,Column2,Colum3,Column4 ,x,y,z ,d,c,v t,l,m,n ,h,s,k ,k,,y z,j, ,p Now if you see column1 for row 1 and row 4 though they are null there is a space but in case of row2 and row 5 there is no space. I want row... (3 Replies)
Discussion started by: RubinPat
3 Replies

3. Shell Programming and Scripting

Space as a delimiter

not sure if i'm doing this right i'm new tho this but i'm trying to use a space as a delimiter with the cut command my code is size=$( du -k -S -s /home/cmik | cut -d' ' -f1 ) i've also tried -f2 and switching the -d and -f around if that does anything (3 Replies)
Discussion started by: Cmik
3 Replies

4. Shell Programming and Scripting

Replacing Comma delimiter coming inside the data.

Hello, I am having flat file (Comma Delimiter) and the data in the file is as given below. EMPNO, ENAME, DESIGNATION, SALARY 10979, Arun Kumar, Cosultant, 35000 13555, Bidhu Shekar, Senior Consultant, 45000 15000, Kiran, Kumar, Senior, Consultant, 40000 If... (9 Replies)
Discussion started by: arunvasu2
9 Replies

5. UNIX for Dummies Questions & Answers

[Solved] How to swap PIPE seperator delimiter?

I have file like below 1|4|OR|OLAP|INT|INT||CONSTANT|2012/08/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|55791|LNR| 2|4|OR|OLAP|CLR|CLR||CONSTANT|2012/09/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|57891|REGS|... (2 Replies)
Discussion started by: gkskumar
2 Replies

6. Red Hat

Converting fixed width file to pipe delimiter in Linux(red-hat)

Hi, I am facing a typical scenario for AWK command . In HP- UNIX is behave as expected but in red hat linux same awk code is not give the same result. The below code is for convert the fixed width file to pipe delimiter file in HP-unix server. awk code: #!/bin/awk -f NR!=1... (11 Replies)
Discussion started by: brij_abhi
11 Replies

7. Shell Programming and Scripting

Removing duplicate lines on first column based with pipe delimiter

Hi, I have tried to remove dublicate lines based on first column with pipe delimiter . but i ma not able to get some uniqu lines Command : sort -t'|' -nuk1 file.txt Input : 38376KZ|09/25/15|1.057 38376KZ|09/25/15|1.057 02006YB|09/25/15|0.859 12593PS|09/25/15|2.803... (2 Replies)
Discussion started by: parithi06
2 Replies

8. Shell Programming and Scripting

Problem in using cut command with pipe as a delimiter while using in a script

There is a text file in my project named as "mom.txt" in which i want to have contents like.................. LSCRM(Application Name): 1: This is my first application. 2: Today we did shell scripting automation for this app. 3: It was really a good fun in doing so. 4: Really good.| (Here i... (7 Replies)
Discussion started by: Abhijeet Anand
7 Replies

9. Shell Programming and Scripting

Replace CRLF between pipe (|) delimiter with LF

Hi Folks! Need a solution for the following :- Source data ------------- 123|123|<CRLF><CRLF><CRLF>|321<CRLF> Required output ------------------ 123|123|<LF><LF><LF>|321<CRLF> <CRLF> represents carriage return <LF> represents line feed Being hunting high and low for a... (10 Replies)
Discussion started by: hishamzz
10 Replies

10. Shell Programming and Scripting

Replace delimiter for a particular column in a pipe delimited file

I have an input file as below Emp1|FirstName|MiddleName|LastName|Address|Pincode|PhoneNumber 1234|FirstName1|MiddleName2|LastName3| Add1 || ADD2|123|000000000 Output : 1234|FirstName1|MiddleName2|LastName3| Add1 ,, ADD2|123|000000000 OR 1234,FirstName1,MiddleName2,LastName3, Add1 ||... (2 Replies)
Discussion started by: styris
2 Replies
IMCLIENT(3)						     Library Functions Manual						       IMCLIENT(3)

 *

NAME
imclient - (library) authenticating callback interface to IMAP/IMSP servers SYNOPSIS
#include <cyrus/imclient.h> int imclient_connect(struct imclient **imclient, const char *host, const char *port); void imclient_close (struct imclient *imclient); void imclient_setflags(struct imclient *imclient, intflags); void imclient_clearflags (struct imclient *imclient, intflags); char* imclient_servername (struct imclient *imclient); void imclient_addcallback (struct imclient * imclient ,...); void imclient_send (struct imclient *imclient, void (*finishproc)(), void *finishrock, const char *fmt, ...); void imclient_getselectinfo (struct imclient *imclient, int *fd, int * wanttowrite); void imclient_processoneevent (struct imclient *imclient); int imclient_authenticate (struct imclient *imclient, struct sasl_client **availmech, const char *service, const char *user, int protal- lowed); int imclient_havetls (); int imclient_starttls (struct imclient *imclient, char *cert_file, char *key_file, char *CAfile, char *CApath); DESCRIPTION
The imclient library functions are distributed with Cyrus IMAP and IMSP. These functions are used for building IMAP/IMSP client software. These functions handle Kerberos authentication and can set callbacks based on the keyword in untagged replies or based on the command tag at the end of command replies. Users must link with the -lcyrus switch, and must supply a function called fatal to be called in case of any error within libcyrus.a. All of the imclient functions begin with the prefix imclient and takes an argument of type struct imclient * as the first argument which is initialized by imclient_connect and freed by imclient_close. See below for a description of each function. imclient_connect() Connects the client server to the host. If successful, it returns 0 and sets the imclient argument to a pointer to an imclient struct. The imclient struct represents the current connection, flags, and callbacks. On failure, the current errno is returned if a system call failed, -1 is returned if the host name was not found, and -2 is returned if the service name was not found. imclient_close() Closes and frees the imclient connection. imclient_setflags() Sets the flags specified by the flags argument on the imclient connection. Currently the only flag allowed is IMCLIENT_CONN_NONSYN- CLITERAL (this flag indicates that the server supports non-synchronizing literals described by the LITERAL+ extension). imclient_clearflags() Clears the flags specified by the flags argument on the imclient connection. imclient_servername() Returns a char * pointer to the name of the server connected to by imclient. imclient_addcallback() Adds an untagged data callback to the imclient connection. The function imclient_addcallback takes callbacks of the type imclient_proc_t which is defined to be: typedef void imclient_proc_t (struct imclient *imclient, void *rock, struct imclient_reply *reply); and struct imclient_reply * is defined to be: struct imclient_reply { char *keyword; long msgno; char *text; }; After the first argument imclient, there can be zero or more instances of the set of keyword, flags, proc, and rock, each adding or changing a single callback. Each instance adds or changes the callback for keyword. The argument, flags, specifies information about the parsing of the untagged data. proc and rock specify the callback function and rock to invoke when the untagged data is received. proc may be a null pointer, in which case no function is invoked. The callback function may not call the functions imclient_close(), imclient_send(), imclient_eof(), imclient_processoneevent(), or imclient_authenticate() on the connection. The call- back function may over write the text of untagged data. imclient_send() Sends a new command to the imclient connection. finishproc and finnishrock are the function and rock called when the command com- pletes. functionproc may be a null pointer, in which case no callback is made. The call back function may not call the functions imclient_close(), imclient_send(), imclient_eof(), imclient_processoneevent(), or imclient_authenticate() on the connection. The argument, fmt , is a print like specification of the command. It must not include the tag as the tag is automatically added by imclient_send(). The defined %-sequences are: %% for % %a for an IMAP atom %s for an astring (which will be quoted or literalized as needed) %d for a decimal %u for an unsigned decimal %v for #astring (argument is a null-terminated array of char * which are written as space separated astrings) imclient_getselectinfo() Gets the information for calling select(2). fd is filled in with the file descriptor to select(2) for read. wanttowrite is filled in with a nonzero value if select should be used for write as well. imclient_processoneevent() Processes one input or output event on the imclient connection. imclient_authenticate() Authenticates the imclient connection using one of the mechanisms in availmech. The argument, user, if not NULL, specifies the user to authenticate as. If the user is NULL, the current user is used. The argument protallowed is a bitmask of permissible protection mechanisms. On success, 0 is returned. On failure (i.e., "BAD" keyboard, or no authentication mechanisms worked), 1 is returned. On extreme fail- ure (premature "OK"), 2 is returned. imclient_havetls() Returns a Boolean indicating whether the imclient library was compiled with TLS (SSL) support. If so, imclient_starttls() may be used to secure the IMAP connection. imclient_starttls() Issues a STARTTLS command on an existing IMAP connection and negotiates the secure link. The cert_file and key_file arguments specify the client certificate and secret key to use to authenticate ourselves to the server. If client authentication is not needed, set both of these arguments to NULL. The CAfile and CApath arguments specify a file or directory, respectively, of CA certificates for validating server certificates. (See SSL_CTX_load_verify_locations(3) for details.) If both of these are NULL, the client will be unable to validate the server's certificate, in which case the connection may succeed but a warning will be printed to stdout. EXAMPLES
The following code is a possible skeletion of imclient that relies on Kerberos to do authentication. This code preforms an IMAP CAPABILITY request and prints out the result. struct sasl_client; #include <cyrus/xmalloc.h> /* example uses xstrdup */ #include <cyrus/sasl.h> #include <cyrus/imclient.h> #include <stdio.h> extern struct sasl_client krb_sasl_client; struct sasl_client *login_sasl_client[] = { &krb_sasl_client, NULL }; struct imclient *imclient; char server[] = "cyrus.andrew.cmu.edu" ; char port[] = "imap"; void fatal(char* message, int rc) { fprintf(stderr, "fatal error: %s ", message); exit(rc); } static void callback_capability(struct imclient *imclient, void *rock, struct imclient_reply *reply) { if (reply->text != NULL) { *((char**)rock) = xstrdup( reply->text ); } } static void end_command (struct imclient *connection, void* rock, struct imclient_reply *inmsg) { (*(int*)rock)--; } main() { char* capability_string; int nc; if (imclient_connect(&imclient, server, port)) { fprintf(stderr, "error: Couldn't connect to %s %s ", server, port); exit(1); } if (imclient_authenticate(imclient, login_sasl_client, "imap" /* service */, NULL /* user */, SASL_PROT_ANY)) { exit(1); } imclient_addcallback(imclient, "CAPABILITY", CALLBACK_NOLITERAL, callback_capability, &capability_string, NULL); nc = 1; imclient_send(imclient, end_command, (void*) &nc, "CAPABILITY"); while(nc > 0) { imclient_processoneevent(imclient); } if (strstr("LITERAL+", capability_string)) { imclient_setflags(imclient, IMCLIENT_CONN_NONSYNCLITERAL); } imclient_send(imclient, NULL, NULL, "LOGOUT"); imclient_close(imclient); printf("capability text is: %s ", capability_string); free(capability_string); } BUGS
No known bugs. SEE ALSO
cyradm, imapd, imspd, RFC2033 (IMAP LITERAL+ extension), RFC2060 (IMAP4rev1 specification), and select(2) KEYWORDS
IMAP, ACAP, IMSP, Kerberos, Authentication CMU
Project Cyrus IMCLIENT(3)
All times are GMT -4. The time now is 05:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy