Sponsored Content
Top Forums Shell Programming and Scripting Sed to print a string until the second occurrence of a character Post 302367088 by Scott on Sunday 1st of November 2009 07:19:54 AM
Old 11-01-2009
If I live to be 100 I'll never understand that stuff ;-)

So a simpler one:
Code:
echo "c:\working\html\index.txt.123.12-12-2009.bkp" | cut -d. -f-2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED replace string by occurrence

hi all, I have a text file with following content PAGENUMBER asasasa asasasa PAGENUMBER sasasasasa PAGENUMBER using sed i want to replace PAGENUMBER by occurrence count eg 1 asasasa asasasa 2 sasasasasa 3 (4 Replies)
Discussion started by: uttamhoode
4 Replies

2. Shell Programming and Scripting

Replace x Number of String Occurrence with Sed

Ok, So I have a huge file that has over 12000 lines in it. in this file, there are 589 occurrences of the string "use five-minute-interval" spread in various areas in the file. How can i replace the the last 250 of the occurrences of "use five-minute-interval" with "use... (10 Replies)
Discussion started by: SkySmart
10 Replies

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

4. Shell Programming and Scripting

[Solved] Sed/awk print between patterns the first occurrence

Guys, 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 blablabla bla bla bla bla 2011-08-14 21:10:04,535 blablabla ERROR blablabla bla bla bla ... (6 Replies)
Discussion started by: ppolianidis
6 Replies

5. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

6. Shell Programming and Scripting

sed print from last occurrence match until the end of file

Hi, i have file f1.txt with data like: CHECK a b CHECK c d CHECK e f JOB_START .... I want to match the last occurrence of 'CHECK' until the end of the file. I can use awk: awk '/^CHECK/ { buf = "" } { buf = buf "\n" $0 } END { print buf }' f1.txt | tail +2Is there a cleaner way of... (2 Replies)
Discussion started by: ysrini
2 Replies

7. Shell Programming and Scripting

Remove last occurrence of character (_) and rest of the string in UNIX (sed)

Hi I need help on this ..!! Input : xx_abc_regA xx_def_regB xx_qwe_regC Now i required the output as the below abc def qwe Need to remove last occurrence of character (_) and rest of the string in Unix (sed). Thanks in Advance ..!!! -Nallachand (3 Replies)
Discussion started by: Nallachand
3 Replies

8. Shell Programming and Scripting

Find last occurrence of a character in a string

Hello how to find last occurence of a string for example in the following I want last occurence of '-' i.e. position 12 str="aa-bbb-cccc-ddd-ee" my pupose is to get the string 'ee' Thanks and Regards Chetanz (5 Replies)
Discussion started by: Chetanz
5 Replies

9. Shell Programming and Scripting

How to insert file contents after nth occurrence of a string using sed?

Hi, I would like to know how, using sed, be able to insert contents of file2 in file1 after say the second occurrence of a given string? e.g. > cat file1 banana apple orange apple banana pear tangerine apple > cat file2 I don't like apples What would be the sed command to insert... (5 Replies)
Discussion started by: dimocn
5 Replies

10. Shell Programming and Scripting

sed print from last occurrence match until the end of last occurrence match

Hi, i have file file.txt with data like: START 03:11:30 a 03:11:40 b END START 03:13:30 eee 03:13:35 fff END jjjjjjjjjjjjjjjjjjjjj START 03:14:30 eee 03:15:30 fff END ggggggggggg iiiiiiiiiiiiiiiiiiiiiiiii I want the below output START (13 Replies)
Discussion started by: Jyotshna
13 Replies
Devel::Caller::IgnoreNamespaces(3pm)			User Contributed Perl Documentation		      Devel::Caller::IgnoreNamespaces(3pm)

NAME
Devel::Caller::IgnoreNamespaces - make available a magic caller() which can ignore namespaces that you tell it about SYNOPSIS
package Foo::Bar use Devel::Caller::IgnoreNamespaces; Devel::Caller::IgnoreNamespaces::register(__PACKAGE__); DESCRIPTION
If your module should be ignored by caller(), just like Hook::LexWrap is by its magic caller(), then call this module's register() subroutine with its name. SUBROUTINES
register('packagename', 'anotherpackage', ...) Takes a list of packages that caller() will ignore in future. BUGS and FEEDBACK Please report any bugs using <http://rt.cpan.org>. The best bug reports include a file with a test in it that fails with the current code and will pass once the bug is fixed. I welcome feedback, especially constructive criticism, by email. Feature requests are more likely to be accepted if accompanied by a patch and tests. AUTHORS, COPYRIGHT and LICENCE This module is maintained by David Cantrell <david@cantrell.org.uk> and based almost entirely on code by Damian Conway. Copyright 2001-2008 Damian Conway Documentation and tests and some code copyright 2009 David Cantrell You may use, modify and distribute this code under either the Artistic Licence or the GNU GPL version 2. See the ARTISTIC.txt or GPL2.txt files for the full texts of the licences. perl v5.10.1 2009-08-19 Devel::Caller::IgnoreNamespaces(3pm)
All times are GMT -4. The time now is 10:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy