Sponsored Content
Top Forums Shell Programming and Scripting How reverse cut or read rows of lines Post 302127625 by doer on Thursday 19th of July 2007 12:02:37 AM
Old 07-19-2007
to more precise the number of underscores are not fixed in my file.

BSC403_JAIN03|3153_TropicalFarm_LIMJM1-3_97|
BSC403_JAIN03|3410_PantaiAcehPCEHM1_4_97|
BSC406_BMIN02|1433_JomHebohTV3_COW7M1_11_97|

so that is the reason why I want to read from reverse and get the value before _97|
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to read a file in reverse

I have to extract data from a text file which is huge in size >>10GB. ie between two strings. If I do an ordinary sed it takes forever to come out. I was wondering if there was anyway to do the entire process in reverse and on finding the relevant string is there any way to break out of the... (5 Replies)
Discussion started by: scorreg
5 Replies

2. HP-UX

Cut rows

Hi, I have a requirement to search for two words and grep all the lines between them. For e.g. : $cat file.dat abc,To,number acd,To,cnz \* flexibile select *\ bcd,To,lla anz,From,kln app,From,lpz I need to get all the lines between the lines cantaining word 'acd' and 'anz'. the... (2 Replies)
Discussion started by: obedkhan
2 Replies

3. Shell Programming and Scripting

read line in reverse order from file

dear all i want to read 5th no of line from last line of file. kindly suggest me possible ways. rgds jaydeep (2 Replies)
Discussion started by: jaydeep_sadaria
2 Replies

4. Shell Programming and Scripting

cut a field, but with reverse order

Hi Everyone, I have one a.txt: a b 001 c b b 002 c c c, not 002 c The output should be 001 002 002 If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused: ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

5. Shell Programming and Scripting

Print rows in reverse order if values decrease along the column

Hi, Guys. Please help me to find solution to this problem using shell scripting. I have an INPUT file with 4 columns separated by tab. Each block of records is separated by ----- ----- Sample1 5402 6680 Pattern01 Sample2 2216 2368 Pattern02... (6 Replies)
Discussion started by: sam_2921
6 Replies

6. Shell Programming and Scripting

CUT command delimiter in reverse

Hi, I've a situation where, a=xxx.yyy.zzz.txt EXTN=`echo $a | cut -d . -f2` Using the above code it delimites and will return "yyy.zzz.txt" to EXTN. But i need to get only the extension "txt". so as per the above code it delimits in the first "." itself. Can anyone help how to do... (6 Replies)
Discussion started by: skcvasanth
6 Replies

7. Shell Programming and Scripting

Cut or awk in reverse

I may be making this too hard on myself, but I'm trying to find a way that I can use a cut or awk string to always remove the last two delimited fields of a string. Say I have PackageName-U939393-8.2.3.4.s390x.rpm But the s390x could be any string w/o periods in it, x8664 for example,... (9 Replies)
Discussion started by: cbo0485
9 Replies

8. Shell Programming and Scripting

How to cut the particular string and increment the rows?

Hi am using unix aix I have tried using awk but am getting only output = x ,its not incrementing next output set -A var1 vv qa za ct=0 i=3 while do var1=`echo ${var1}` count=`awk ' NR==$i++ {print;exit}' ${.txt} | cut -c5 ` echo $count let ct=ct+1 done (6 Replies)
Discussion started by: Venkatesh1
6 Replies

9. Shell Programming and Scripting

Reverse even lines

I'm trying to reverse every even line in my file using the awk command below but it prints only the odd lines but nothing else: $ awk '(NR % 2) {print}; !(NR % 2) {print | "rev";}' myfile Any idea what I might have done wrong? Thank you. (10 Replies)
Discussion started by: ivpz
10 Replies

10. UNIX for Dummies Questions & Answers

How to cut part of a string in reverse?

Hi, how to cut part of a string sing delimiter in reverse input file 1,2,st-pa-tr-01,2,3,4, 2,3,ff-ht-05,6,7,8 how can i obtain strings till st-pa-tr ff-ht i.e cutting the last part og string -01 and -05 Thanks & Regards Nivi edit by bakunin: changed thread title (typo) (3 Replies)
Discussion started by: nivI
3 Replies
BIO_should_retry(3)						      OpenSSL						       BIO_should_retry(3)

NAME
BIO_should_retry, BIO_should_read, BIO_should_write, BIO_should_io_special, BIO_retry_type, BIO_should_retry, BIO_get_retry_BIO, BIO_get_retry_reason - BIO retry functions SYNOPSIS
#include <openssl/bio.h> #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) #define BIO_FLAGS_READ 0x01 #define BIO_FLAGS_WRITE 0x02 #define BIO_FLAGS_IO_SPECIAL 0x04 #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) #define BIO_FLAGS_SHOULD_RETRY 0x08 BIO * BIO_get_retry_BIO(BIO *bio, int *reason); int BIO_get_retry_reason(BIO *bio); DESCRIPTION
These functions determine why a BIO is not able to read or write data. They will typically be called after a failed BIO_read() or BIO_write() call. BIO_should_retry() is true if the call that produced this condition should then be retried at a later time. If BIO_should_retry() is false then the cause is an error condition. BIO_should_read() is true if the cause of the condition is that a BIO needs to read data. BIO_should_write() is true if the cause of the condition is that a BIO needs to read data. BIO_should_io_special() is true if some "special" condition, that is a reason other than reading or writing is the cause of the condition. BIO_retry_type() returns a mask of the cause of a retry condition consisting of the values BIO_FLAGS_READ, BIO_FLAGS_WRITE, BIO_FLAGS_IO_SPECIAL though current BIO types will only set one of these. BIO_get_retry_BIO() determines the precise reason for the special condition, it returns the BIO that caused this condition and if reason is not NULL it contains the reason code. The meaning of the reason code and the action that should be taken depends on the type of BIO that resulted in this condition. BIO_get_retry_reason() returns the reason for a special condition if passed the relevant BIO, for example as returned by BIO_get_retry_BIO(). NOTES
If BIO_should_retry() returns false then the precise "error condition" depends on the BIO type that caused it and the return code of the BIO operation. For example if a call to BIO_read() on a socket BIO returns 0 and BIO_should_retry() is false then the cause will be that the connection closed. A similar condition on a file BIO will mean that it has reached EOF. Some BIO types may place additional information on the error queue. For more details see the individual BIO type manual pages. If the underlying I/O structure is in a blocking mode almost all current BIO types will not request a retry, because the underlying I/O calls will not. If the application knows that the BIO type will never signal a retry then it need not call BIO_should_retry() after a failed BIO I/O call. This is typically done with file BIOs. SSL BIOs are the only current exception to this rule: they can request a retry even if the underlying I/O structure is blocking, if a handshake occurs during a call to BIO_read(). An application can retry the failed call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY on the underlying SSL structure. While an application may retry a failed non blocking call immediately this is likely to be very inefficient because the call will fail repeatedly until data can be processed or is available. An application will normally wait until the necessary condition is satisfied. How this is done depends on the underlying I/O structure. For example if the cause is ultimately a socket and BIO_should_read() is true then a call to select() may be made to wait until data is available and then retry the BIO operation. By combining the retry conditions of several non blocking BIOs in a single select() call it is possible to service several BIOs in a single thread, though the performance may be poor if SSL BIOs are present because long delays can occur during the initial handshake process. It is possible for a BIO to block indefinitely if the underlying I/O structure cannot process or return any data. This depends on the behaviour of the platforms I/O functions. This is often not desirable: one solution is to use non blocking I/O and use a timeout on the select() (or equivalent) call. BUGS
The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: that is they cannot retry after a partial read or write. This is usually worked around by only passing the relevant data to ASN1 functions when the entire structure can be read or written. SEE ALSO
TBA 50 2013-03-05 BIO_should_retry(3)
All times are GMT -4. The time now is 11:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy