Sponsored Content
Top Forums Shell Programming and Scripting delete line upto the nth occurence of a particular charachter. Post 302360122 by Scrutinizer on Thursday 8th of October 2009 07:15:40 AM
Old 10-08-2009
Code:
 echo 'cp cms/images/wifi-zone.css.php'| sed 's/.*\.//'

Code:
 echo 'cp cms/images/wifi-zone.css.php'| awk -F. '{print $NF}'

Code:
echo 'cp cms/images/wifi-zone.css.php'| grep -o '[^.]*$'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace matching nth occurence

Hi for eg my file has: val1 | val2 | val1 | val2 | val1 | val2 | val1 | val2 | here i need to replace '|' with '|\n' where the occurence of '|' is divisble by 2 so that the output comes like this val1 | val2 | val1 | val2 | val1 | val2 | val1 | val2 | Requesting suggestions in... (1 Reply)
Discussion started by: raghav288
1 Replies

2. Shell Programming and Scripting

Replacing nth occurence

Hi My input file is like this for eg: abc abc abc abc abc abc i would like to replace "abc" with "cba" where the occurrence is divisible by 2 of eg here 2nd, 4th and 6th occurence shud be replace can anyone suggest in awk or sed (11 Replies)
Discussion started by: raghav288
11 Replies

3. Shell Programming and Scripting

Convert special charachter ^C to new line

Hi, I have a file, which contains ^C or ^A characters from mainfrme system, it's dec 192 or octal 300 hex C0. I want to replace this character with new line. I used commands, but it didn't worked. tr '\o300' '\n' <t >t2 #or tr '\xC0' '\n' <t > t2 Can somebody help me to do... (2 Replies)
Discussion started by: vnag97
2 Replies

4. UNIX for Dummies Questions & Answers

To find the Nth Occurence of Search String

Hi guys, I like to find the Line number of Nth Occurence of a Search string in a file. If possible, if it will land the cursor to that particualar line will be great. Cheers!! (3 Replies)
Discussion started by: mac4rfree
3 Replies

5. UNIX for Dummies Questions & Answers

how to delete nth line

can you please tell me (1) how to delete 1st and 3rd line only from a file. (2) How to delete last 4 lines in a file that has 2 blank lines out of last 4 lines. Thank you. (2 Replies)
Discussion started by: Ariean
2 Replies

6. Shell Programming and Scripting

Delete until Nth occurence (sed, awk)

Hello people, Once more I need your help with SED/AWK I need to delete up to the Nth occurence of a char (from the beggining) and until the Mth occurence of a char (from the end) Example: Input: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z Output: i,j Must delete up to the... (2 Replies)
Discussion started by: drbiloukos
2 Replies

7. UNIX for Dummies Questions & Answers

Extract until nth occurence

Hi, I couldn't figure how to extract until last occurence of a character. I have the string ./dir1/file1/abc.sh The output should be /dir1/file1 So, the command should display the path until last occurence of "/". Thanks. (3 Replies)
Discussion started by: rajivn786
3 Replies

8. UNIX for Dummies Questions & Answers

Vi delete line with second occurence of pattern

I have a large file and many lines are duplicated. I'm trying to delete lines with every second occurrence of a pattern. Did tried searching similar question but no luck. I can delete all lines matching pattern with :g/pattern/d but don't want to lose data. Sample pattern to delete... (6 Replies)
Discussion started by: homer4all
6 Replies

9. Shell Programming and Scripting

Get nth occurence of string from a file

I have file in which the data looks like this, 01,0000000,xxxxxxx/ 02,xxxxxxxx,yyyyyy/ 03,test1,41203016,,/ 01,0000000,xxxxxxx/ 02,xxxxxxxx,yyyyyy/ ... (16 Replies)
Discussion started by: r@v!7*7@
16 Replies

10. Shell Programming and Scripting

Delete after nth occurence of string in each line

Hello, Environment: I am under Ubuntu 18.04 bionic. I have an sql file consisting of 10K lines. Objective: What I am trying to attain is to remove everything coming after 2nd tab in each line. While searching for the answer, I found two answers and both gave expected result just for the first... (2 Replies)
Discussion started by: baris35
2 Replies
CMS_add0_cert(3)						      OpenSSL							  CMS_add0_cert(3)

NAME
CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions SYNOPSIS
#include <openssl/cms.h> int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); DESCRIPTION
CMS_add0_cert() and CMS_add1_cert() add certificate cert to cms. must be of type signed data or enveloped data. CMS_get1_certs() returns all certificates in cms. CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. CMS_get1_crls() returns any CRLs in cms. NOTES
The CMS_ContentInfo structure cms must be of type signed data or enveloped data or an error will be returned. For signed data certificates and CRLs are added to the certificates and crls fields of SignedData structure. For enveloped data they are added to OriginatorInfo. As the 0 implies CMS_add0_cert() adds cert internally to cms and it must not be freed up after the call as opposed to CMS_add1_cert() where cert must be freed up. The same certificate or CRL must not be added to the same cms structure more than once. RETURN VALUES
CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return 1 for success and 0 for failure. CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs or NULL if there are none or an error occurs. The only error which will occur in practice is if the cms type is invalid. SEE ALSO
ERR_get_error(3), CMS_sign(3), CMS_encrypt(3) HISTORY
CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl() and CMS_get1_crls() were all first added to OpenSSL 0.9.8 1.0.1e 2013-02-11 CMS_add0_cert(3)
All times are GMT -4. The time now is 02:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy