Sponsored Content
Top Forums Shell Programming and Scripting Delete after nth occurence of string in each line Post 303025962 by baris35 on Thursday 15th of November 2018 04:30:59 PM
Old 11-15-2018
Hello Don,
Thank you so much... As expected!

Boris
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing a string in nth line

Hello All, How to replace a string in nth line of a file using sed or awk. For Ex: test.txt Line 1 : TEST1 TEST2 TEST3 Line 2 : TEST1 TEST2 TEST3 TEST4 Line 3 : TEST1 TEST2 TEST3 TEST5 Line 4 : TEST1 TEST2 TEST3 TEST6 Line 5 : TEST1 TEST2 TEST3 TEST7 i want to go to 4th line of a... (1 Reply)
Discussion started by: maxmave
1 Replies

2. Shell Programming and Scripting

delete line upto the nth occurence of a particular charachter.

hi all i want to delete a line upto a particular character. here is example. cp cms/images/wifi-zone.png i want to delete the line till . (cp cms/images/wifi-zone.) so the output wud be "png" only how can i do it? also please note down that dot (.) can also occur multiple... (12 Replies)
Discussion started by: kashifv
12 Replies

3. 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

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

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
TFBS::SitePairSet(3pm)					User Contributed Perl Documentation				    TFBS::SitePairSet(3pm)

NAME
TFBS::SitePairSet - a set of TFBS::SitePair objects SYNOPSIS
my $site_pair_set = TFBS::SitePairSet->new(@list_of_site_pair_objects); # add a TFBS::SitePair object to set: $site_pair_set->add_site_pair($site_pair_obj); # append another TFBS::SitePairSet contents: $site_pair_set->add_site_pair_set($site_pair_obj); # create an iterator: my $it = $site_pair_set->Iterator(-sort_by => 'start'); DESCRIPTION
TFBS::SitePairSet is an aggregate class that contains a collection of TFBS::SitePair objects. It can be created anew and filled with TFBS::Site::Pair object. It is also returned by search_aln() method call of TFBS::PatternI subclasses (e.g. TFBS::Matrix::PWM). FEEDBACK
Please send bug reports and other comments to the author. AUTHOR - Boris Lenhard Boris Lenhard <Boris.Lenhard@cgb.ki.se> APPENDIX
The rest of the documentation details each of the object methods. Internal methods are preceded with an underscore. size Title : size Usage : my $size = $sitepairset->size() Function: returns a number of TFBS::SitePair objects contained in the set Returns : a scalar (integer) Args : none add_site_pair Title : add_site_pair Usage : $sitepairset->add_site_pair($site_pair_object) $sitepairset->add_site_pair(@list_of_site_pair_objects) Function: adds TFBS::SitePair objects to an existing TFBS::SitePairSet object Returns : $sitepairset object (usually ignored) Args : A list of TFBS::SitePair objects to add add_site_pair_set Title : add_site_pair_set Usage : $sitepairset->add_site_pair_set($site_pair_set_object) $sitepairset->add_site_pair(@list_of_site_pair_set_objects) Function: adds the contents of other TFBS::SitePairSet objects to an existing TFBS::SitePairSet object Returns : $sitepairset object (usually ignored) Args : A list of TFBS::SitePairSet objects whose contents should be added to $sitepairset Iterator Title : Iterator Usage : my $it = $sitepairset->Iterator(-sort_by=>'start'); while (my $site_pair = $it->next()) { #... Function: Returns an iterator object, used to iterate thorugh elements (TFBS::SitePair objects) Returns : a TFBS::_Iterator object Args : -sort_by # optional - currently it accepts # (default sort order in parenthetse) # 'name' (pattern name, alphabetically) # 'ID' (pattern/matrix ID, alphabetically) # 'start' (site start in sequence, # numerically,increasing order) # 'end' (site end in sequence, # numerically, increasing order) # 'score' (1st site in pair, # numerically, decreasing order) -reverse # optional - reverses the default sorting order if true set1 set2 Title : set1 set2 Usage : my $siteset1 = $sitepairset->set1(); : my $siteset2 = $sitepairset->set2() Function: Returns individual TFBS::SiteSet objects, from the site set pair Returns : A TFBS::SiteSet object Args : none GFF Title : GFF Usage : print $site->GFF(); : print $site->GFF($gff_formatter) Function: returns a "standard" multiline GFF string Returns : a string (multiline, newline terminated) Args : a $gff_formatter function reference (optional) perl v5.14.2 2008-01-24 TFBS::SitePairSet(3pm)
All times are GMT -4. The time now is 04:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy