Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Awk/sed command to extract the string between 2 patterns but having some particular value Post 303039115 by gull04 on Monday 23rd of September 2019 08:09:34 AM
Old 09-23-2019
Hi,

Yes I was aware of the mistake, however by the time that I went in to rectify it -Madein Germany had posted two solutions, which is why I updated the post the way I did.

Regards

Gull04
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To extract the string between two patterns

Sample input: Loading File System Networking in nature Closing the System now i need to extract the patterns between the words File and Closing: i.e. sample output: System Networking in Nature Thanks in advance !!!!!!!!!!!!!!!!! (6 Replies)
Discussion started by: aajan
6 Replies

2. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

3. Shell Programming and Scripting

deleting lines between patterns using sed or awk

hi, Here is excerpt from my xml file <!-- The custom module to do the authentication for LDAP --> </login-module> <login-module code="com.nlayers.seneca.security.LdapLogin" flag="sufficient"> <module-option... (1 Reply)
Discussion started by: sunrexstar
1 Replies

4. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

5. Shell Programming and Scripting

Sed/awk print between different patterns the first occurrence

Thanks for the help yesterday. I have a little modification today, I am trying the following: i have a log file of a webbap which logs in the following pattern: 2011-08-14 21:10:04,535 blablabla ERROR Exception1 blablabla bla bla bla bla 2011-08-14... (2 Replies)
Discussion started by: ppolianidis
2 Replies

6. Shell Programming and Scripting

Patterns with egrep/sed/awk?

I have an array with characters, what I want is if there are other characters in the array which I am looking for than take action that is print BAD ARRAY. So far my code just finds characters but instead I want that it should look for other characters. echo "A B C D F" | egrep -o "D | F" O/P... (5 Replies)
Discussion started by: dixits
5 Replies

7. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

8. Shell Programming and Scripting

String search between patterns using sed

Hi, I am trying to find a way to get sed/awk/grep to help me find a string in a log file that exists between two datestamps and then print the preceding datestamp up to the next datestamp. Here is an example of my logfile: +++ 2013/03/28 17:01:37.085 SIGNALING HIGH ACTIVE Failure Response... (5 Replies)
Discussion started by: raytx
5 Replies

9. Shell Programming and Scripting

awk extract strings matching multiple patterns

Hi, I wasn't quite sure how to title this one! Here goes: I have some already partially parsed log files, which I now need to extract info from. Because of the way they are originally and the fact they have been partially processed already, I can't make any assumptions on the number of... (8 Replies)
Discussion started by: chrissycc
8 Replies

10. UNIX for Beginners Questions & Answers

Sed, awk or another bash command to modify string with the content of another file

Hello everybody, I would like modify some strings using sed or another command line with the content file. For example: - {fqdn: "server-01" , ip: "server-01"} - {fqdn: "server-02" , ip: "server-02"} - {fqdn: "server-03" , ip: "server-03"} - {fqdn: "server-04" , ip: "server-04"} My... (4 Replies)
Discussion started by: dco
4 Replies
CURLOPT_PINNEDPUBLICKEY(3)				     curl_easy_setopt options					CURLOPT_PINNEDPUBLICKEY(3)

NAME
CURLOPT_PINNEDPUBLICKEY - set pinned public key SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PINNEDPUBLICKEY, char *pinnedpubkey); DESCRIPTION
Pass a pointer to a zero terminated string as parameter. The string can be the file name of your pinned public key. The file format expected is "PEM" or "DER". The string can also be any number of base64 encoded sha256 hashes preceded by "sha256//" and separated by ";" When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this cer- tificate and if it does not exactly match the public key provided to this option, curl will abort the connection before sending or receiv- ing any data. On mismatch, CURLE_SSL_PINNEDPUBKEYNOTMATCH is returned. The application does not have to keep the string around after setting this option. DEFAULT
NULL PROTOCOLS
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "/etc/publickey.der"); /* OR curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "sha256//YhKJKSzoTt2b5FP18fvpHo7fJYqQCjAa3HWY3tvRMwE=;sha256//t62CeU2tQiqkexU74Gxa2eg7fRbEgoChTociMee9wno="); */ /* Perform the request */ curl_easy_perform(curl); } PUBLIC KEY EXTRACTION
If you do not have the server's public key file you can extract it from the server's certificate. # retrieve the server's certificate if you don't already have it # # be sure to examine the certificate to see if it is what you expected # # Windows-specific: # - Use NUL instead of /dev/null. # - OpenSSL may wait for input instead of disconnecting. Hit enter. # - If you don't have sed, then just copy the certificate into a file: # Lines from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----. # openssl s_client -servername www.example.com -connect www.example.com:443 < /dev/null | sed -n "/-----BEGIN/,/-----END/p" > www.example.com.pem # extract public key in pem format from certificate openssl x509 -in www.example.com.pem -pubkey -noout > www.example.com.pubkey.pem # convert public key from pem to der openssl asn1parse -noout -inform pem -in www.example.com.pubkey.pem -out www.example.com.pubkey.der # sha256 hash and base64 encode der to string for use openssl dgst -sha256 -binary www.example.com.pubkey.der | openssl base64 The public key in PEM format contains a header, base64 data and a footer: -----BEGIN PUBLIC KEY----- [BASE 64 DATA] -----END PUBLIC KEY----- AVAILABILITY
PEM/DER support: 7.39.0: OpenSSL, GnuTLS and GSKit 7.43.0: NSS and wolfSSL/CyaSSL 7.47.0: mbedtls 7.49.0: PolarSSL sha256 support: 7.44.0: OpenSSL, GnuTLS, NSS and wolfSSL/CyaSSL 7.47.0: mbedtls 7.49.0: PolarSSL Other SSL backends not supported. RETURN VALUE
Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. SEE ALSO
CURLOPT_SSL_VERIFYPEER(3), CURLOPT_SSL_VERIFYHOST(3), CURLOPT_CAINFO(3), CURLOPT_CAPATH(3), libcurl 7.54.0 December 21, 2016 CURLOPT_PINNEDPUBLICKEY(3)
All times are GMT -4. The time now is 01:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy