Re: Sed question

2008-12-23 Thread Matthew Seaman
Gary Kline wrote: On Mon, Dec 22, 2008 at 08:53:36AM +, Matthew Seaman wrote: Gary Kline wrote: anyway, this is one for giiorgos, or another perl wiz. i've been using the perl subsitution cmd one-liner for years with unfailing success. is there a way of deleting li

Re: Sed question

2008-12-23 Thread Gary Kline
On Mon, Dec 22, 2008 at 08:53:36AM +, Matthew Seaman wrote: > Gary Kline wrote: > > > anyway, this is one for giiorgos, or another perl wiz. i've > > been using the perl subsitution cmd one-liner for years with > > unfailing success. is there a way of deleting lines with perl > >

Re: Sed question

2008-12-22 Thread Matthew Seaman
Gary Kline wrote: anyway, this is one for giiorgos, or another perl wiz. i've been using the perl subsitution cmd one-liner for years with unfailing success. is there a way of deleting lines with perl using the same idea as: perl -pi.bak -e 's/OLDSTRIN

Re: Sed question

2008-12-22 Thread Jonathan McKeown
On Monday 22 December 2008 00:27:44 Gary Kline wrote: > > anyway, this is one for giiorgos, or another perl wiz. i've > been using the perl subsitution cmd one-liner for years with > unfailing success. is there a way of deleting lines with perl > using the same idea as: > >

Re: Sed question

2008-12-21 Thread Polytropon
On Mon, 22 Dec 2008 05:31:08 +0200, Giorgos Keramidas wrote: > On Sun, 21 Dec 2008 14:27:44 -0800, Gary Kline wrote: > > perl -pi.bak -e 's/OLDSTRING/NEWSTRING/g' file1 file2 fileN > > > > that i swiped somewhere. [?] > > > > last night i was up until the wee hours coding or e

Re: Sed question

2008-12-21 Thread Giorgos Keramidas
On Sun, 21 Dec 2008 14:27:44 -0800, Gary Kline wrote: > perl -pi.bak -e 's/OLDSTRING/NEWSTRING/g' file1 file2 fileN > > that i swiped somewhere. [?] > > last night i was up until the wee hours coding or extending > a c++ program to assist in this stuff. while i re

Re: Sed question

2008-12-21 Thread Gary Kline
On Sun, Dec 21, 2008 at 03:06:58PM +0100, Bertram Scharpf wrote: > Hi, > > Am Sonntag, 21. Dez 2008, 02:08:04 -0800 schrieb Gary Kline: > > On Sun, 2008-12-21 at 07:42 +0200, Giorgos Keramidas wrote: > > > On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > > > > > > > > sed '8,10d'< file> ne

Re: Sed question

2008-12-21 Thread Bertram Scharpf
Hi, Am Sonntag, 21. Dez 2008, 02:08:04 -0800 schrieb Gary Kline: > On Sun, 2008-12-21 at 07:42 +0200, Giorgos Keramidas wrote: > > On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > > > > > > sed '8,10d'< file> newfile > > > or is there a better way? > > > > keram...@kobe:/tmp$ sed -i ''

Re: Sed question

2008-12-21 Thread Gary Kline
On Sun, 2008-12-21 at 07:42 +0200, Giorgos Keramidas wrote: > On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > > how can i delete, say, lines 8,9,and 10 from 200 files > > using sed? Is it > > > > sed '8,10d'< file> newfile > > or is there a better way? > > Use in-place editing: > > ke

Re: Sed question

2008-12-20 Thread Corey Chandler
Gary Kline wrote: how can i delete, say, lines 8,9,and 10 from 200 files using sed? Is it sed '8,10d'< file> newfile or is there a better way? I'd stick it in a for loop using inplace editing, but yes. :-) ___ fre

Re: Sed question

2008-12-20 Thread prad
On Sat, 20 Dec 2008 21:34:10 -0800 Gary Kline wrote: > or is there a better way? > nothing specific to add for your particular issue, but this link may be useful in the future for sed: http://sed.sourceforge.net/grabbag/tutorials/ -- In friendship, prad ..

Re: Sed question

2008-12-20 Thread Giorgos Keramidas
On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > how can i delete, say, lines 8,9,and 10 from 200 files > using sed? Is it > > sed '8,10d'< file> newfile > or is there a better way? Use in-place editing: keram...@kobe:/tmp$ cat -n foo 1 foo 2 bar 3 baz keram..

Re: sed question...

2007-09-25 Thread Giorgos Keramidas
On 2007-09-25 22:49, Pollywog <[EMAIL PROTECTED]> wrote: > On Tuesday 25 September 2007 22:21:48 Giorgos Keramidas wrote: > > A word of caution there... > > > > If you plan to use GNU/Linux manpages for learning sed(1) be _very_ > > cautious for GNU/Linux-specific parts. There are subtle, yet > >

Re: sed question...

2007-09-25 Thread Pollywog
On Tuesday 25 September 2007 22:21:48 Giorgos Keramidas wrote: > > A word of caution there... > > If you plan to use GNU/Linux manpages for learning sed(1) be _very_ > cautious for GNU/Linux-specific parts. There are subtle, yet possibly > important differences between GNU/Linux sed and BSD sed.

Re: sed question...

2007-09-25 Thread Gary Kline
On Wed, Sep 26, 2007 at 01:21:48AM +0300, Giorgos Keramidas wrote: > On 2007-09-25 11:28, Gary Kline <[EMAIL PROTECTED]> wrote: > > Thank you! This will help me de-code that sed one-liner that was > > evidently written by a sedexpert. The linux pages help further, but > > I've found some soild tut

Re: sed question...

2007-09-25 Thread Giorgos Keramidas
On 2007-09-25 11:28, Gary Kline <[EMAIL PROTECTED]> wrote: > Thank you! This will help me de-code that sed one-liner that was > evidently written by a sedexpert. The linux pages help further, but > I've found some soild tutorials. Hi Gary. A word of caution there... If you plan to use GNU/Lin

Re: sed question...

2007-09-25 Thread Gary Kline
On Tue, Sep 25, 2007 at 08:50:57PM +0300, Nikos Vassiliadis wrote: > Gary, > > This will probably help you, it has many nice one-liners. > > http://sed.sourceforge.net/grabbag/tutorials/sed1line.txt > > Nikos Aww, you found my stash:) But as I said, up-queue, I'm overdue to u

Re: sed question...

2007-09-25 Thread Gary Kline
On Tue, Sep 25, 2007 at 08:38:50PM +0300, Nikos Vassiliadis wrote: > On Tuesday 25 September 2007 19:58, Gary Kline wrote: > > But trying to parse this from man sed is more than > > difficule. And I have yet to find "ba" in the man page. That is > > why I asked for some insights rathe

Re: sed question...

2007-09-25 Thread Nikos Vassiliadis
Gary, This will probably help you, it has many nice one-liners. http://sed.sourceforge.net/grabbag/tutorials/sed1line.txt Nikos ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe,

Re: sed question...

2007-09-25 Thread Nikos Vassiliadis
On Tuesday 25 September 2007 19:58, Gary Kline wrote: > But trying to parse this from man sed is more than > difficule. And I have yet to find "ba" in the man page. That is > why I asked for some insights rather that to be told to "go read > the man page"; to me, that's di

Re: sed question...

2007-09-25 Thread Gary Kline
On Tue, Sep 25, 2007 at 01:05:06PM -0400, Howard Goldstein wrote: > > > Giorgos Keramidas wrote: > > On 2007-09-24 20:52, Gary Kline <[EMAIL PROTECTED]> wrote: > > > >> On Mon, Sep 24, 2007 at 11:07:20PM -0400, Howard Goldstein wrote: > >> > # delete the last 10 lines of a file > >>

Re: sed question...

2007-09-25 Thread Gary Kline
On Tue, Sep 25, 2007 at 07:24:25PM +0300, Giorgos Keramidas wrote: > On 2007-09-24 20:52, Gary Kline <[EMAIL PROTECTED]> wrote: > >On Mon, Sep 24, 2007 at 11:07:20PM -0400, Howard Goldstein wrote: > >>> # delete the last 10 lines of a file > >>> sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1 >

Re: sed question...

2007-09-25 Thread Howard Goldstein
Giorgos Keramidas wrote: > On 2007-09-24 20:52, Gary Kline <[EMAIL PROTECTED]> wrote: > >> On Mon, Sep 24, 2007 at 11:07:20PM -0400, Howard Goldstein wrote: >> # delete the last 10 lines of a file sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1 sed -n -e :a -e '1,10!{P;

Re: sed question...

2007-09-25 Thread Gary Kline
On Tue, Sep 25, 2007 at 09:31:04AM +0300, Nikos Vassiliadis wrote: > On Tuesday 25 September 2007 06:07, Howard Goldstein wrote: > > Gary Kline wrote: > > > My earlier post about deleting the first N lines was answered by > > > this one-liner site {below}. I wasn't including any > > > redir

Re: sed question...

2007-09-25 Thread Giorgos Keramidas
On 2007-09-24 20:52, Gary Kline <[EMAIL PROTECTED]> wrote: >On Mon, Sep 24, 2007 at 11:07:20PM -0400, Howard Goldstein wrote: >>> # delete the last 10 lines of a file >>> sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1 >>> sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2 >>> >>> Question t

Re: sed question...

2007-09-24 Thread Nikos Vassiliadis
On Tuesday 25 September 2007 06:07, Howard Goldstein wrote: > Gary Kline wrote: > > My earlier post about deleting the first N lines was answered by > > this one-liner site {below}. I wasn't including any > > redirection; doing so finally resolved the problem. Now I need > > to d

Re: sed question...

2007-09-24 Thread Gary Kline
On Mon, Sep 24, 2007 at 11:07:20PM -0400, Howard Goldstein wrote: > Gary Kline wrote: > > My earlier post about deleting the first N lines was answered by > > this one-liner site {below}. I wasn't including any > > redirection; doing so finally resolved the problem. Now I need > >

Re: sed question...

2007-09-24 Thread Howard Goldstein
Gary Kline wrote: > My earlier post about deleting the first N lines was answered by > this one-liner site {below}. I wasn't including any > redirection; doing so finally resolved the problem. Now I need > to delete every line from the 19th or so to the last line. >

Re: sed question[s]

2007-09-24 Thread Giorgos Keramidas
On 2007-09-24 14:07, Gary Kline <[EMAIL PROTECTED]> wrote: > Hi, > I could probably do at least part of this with an ed shell > script, but sed is probaly more standard. (I may have asked this > before, years back: FWIW. Anyhow, don't see it in my > ~/Mail/freebsd files.) > > How can I automagica