On Tue, Oct 06, 2009 at 11:45:36PM -0700, David Allen wrote:
> I keep bumping up against this, so I thought I'd throw this question out
> to those who understand sed better than I do.
>
> What I'm trying to do is to clean up the contents of some files
> (/sys/i386/conf/GENERIC would be a good exam
David Allen wrote:
> I keep bumping up against this, so I thought I'd throw this question out
> to those who understand sed better than I do.
>
> What I'm trying to do is to clean up the contents of some files
> (/sys/i386/conf/GENERIC would be a good example) to get more readable
> diffs.
Uh, I know I'm stating the obvious, but you might try these 2
techniques to enhance your diff experience:
1. Use "diff -w".
2. Do "cat filename | sort > filename.sorted" for both files you are
diffing, and then compare both sorted files.
___
freebsd-ques
I keep bumping up against this, so I thought I'd throw this question out
to those who understand sed better than I do.
What I'm trying to do is to clean up the contents of some files
(/sys/i386/conf/GENERIC would be a good example) to get more readable
diffs. To that end, I'm trying to use sed to
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
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
> >
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
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:
>
>
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
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
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
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 ''
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
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
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
..
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..
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?
tia,
gary
--
Gary Kline kl...@thought.org http://www.thought.org Public Service Unix
http://jottings.thoug
--- On Wed, 7/9/08, Bertram Scharpf <[EMAIL PROTECTED]> wrote:
> From: Bertram Scharpf <[EMAIL PROTECTED]>
> Subject: Re: A sed question
> To: "Unga" <[EMAIL PROTECTED]>, freebsd-questions@freebsd.org
> Date: Wednesday, July 9, 2008, 6:52 PM
> Hii,
>
Hii,
Am Mittwoch, 09. Jul 2008, 00:35:32 -0700 schrieb Unga:
> I want to translate following GNU sed lines to FreeBSD sed:
>
> 1. sed -e '/\*address:/{n;[EMAIL PROTECTED]@replaceText @}'
> 2. sed -e '/\*address:/{n;[EMAIL PROTECTED]@ [EMAIL PROTECTED]'
An obvious problem is that a semicolon is m
Hi all
I want to translate following GNU sed lines to FreeBSD sed:
1. sed -e '/\*address:/{n;[EMAIL PROTECTED]@replaceText @}'
2. sed -e '/\*address:/{n;[EMAIL PROTECTED]@ [EMAIL PROTECTED]'
Appreciate if someone could help with it.
Is there a good documentation about FreeBSD sed other than ma
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
> >
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.
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
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
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
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
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,
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
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
> >>
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
>
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;
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
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
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
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
> >
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.
>
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.
Question one, can
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
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 automagically delete from $1,155d
On Mon, 15 Mar 2004, Parv wrote:
> in message <[EMAIL PROTECTED]>,
> wrote Warren Block thusly...
> >
> > perl -pe 's/\s./\n/g' my_test_text_document.txt
> ^
> ^
>
> Why do you have '.' after '\s'? Did you mean '+' instead?
Oops--you're correct. \s+ for one or mo
in message <[EMAIL PROTECTED]>,
wrote Warren Block thusly...
>
> ...sed on other systems does handle \n and other literals in
> substitutions. It's annoying enough that I just use Perl instead.
>
> perl -pe 's/ /\n/g' my_test_text_document.txt
>
> which actually would be better as
>
> perl -pe
On Sun, Mar 14, 2004 at 04:30:40PM -0600, Steven N. Fettig wrote:
> Sorry for posting an off-topic question to the list, but this is
> somethin that has been driving me nuts for weeks now and I can't figure
> it out. I want to pass a text file through sed that replaces all
> whitespaces with a
On Sun, 14 Mar 2004, Rob Ellis wrote:
> This works with sed in /bin/sh and ksh:
>
> sed -e 's/ */\
> /g' my_test_text_document.txt
>
> I.e., escape an actual newline.
I used to do that, or include an actual newline in a script, but it just
seems wrong from maintainability and readability standpo
On Sun, Mar 14, 2004, Warren Block wrote:
>On Sun, 14 Mar 2004, Steven N. Fettig wrote:
>
>> I can't figure out what the newline character is... I've tried \n \r &\,
>> etc. with no avail. I run the following:
>>
>> sed 's/[ ]/\n/g' my_test_text_document.txt
>
>>From the sed man page:
>
>"2. The
On Sun, Mar 14, 2004 at 04:50:40PM -0700, Warren Block wrote:
> On Sun, 14 Mar 2004, Steven N. Fettig wrote:
>
> > I can't figure out what the newline character is... I've tried \n \r &\,
> > etc. with no avail. I run the following:
> >
> > sed 's/[ ]/\n/g' my_test_text_document.txt
>
> >From th
On Sun, 14 Mar 2004, Steven N. Fettig wrote:
> I can't figure out what the newline character is... I've tried \n \r &\,
> etc. with no avail. I run the following:
>
> sed 's/[ ]/\n/g' my_test_text_document.txt
>From the sed man page:
"2. The escape sequence \n matches a newline character embe
On Sun, Mar 14, 2004 at 04:30:40PM -0600, Steven N. Fettig wrote:
> Sorry for posting an off-topic question to the list, but this is
> somethin that has been driving me nuts for weeks now and I can't figure
> it out. I want to pass a text file through sed that replaces all
> whitespaces with a
Sorry for posting an off-topic question to the list, but this is
somethin that has been driving me nuts for weeks now and I can't figure
it out. I want to pass a text file through sed that replaces all
whitespaces with a carriage return. I.e., if I have the file
my_test_text_document.txt that
Not directly FreeBSD question, however. Is it possible with sed (or awk)
to turn this:
i/in/1 2/3 4 5 6
into
i/in/1 2/3456
The same syntax would also need to work on:
i/in/1 2/x y z (result would be i/in/1 2/xyz)
i/in/1 2 (result would be i/in/12)
The closest I have gotten it to is:
i/in/1 2/3
On Nov 07, Paul A. Scott wrote:
> > How about echo abc | tr 'b' '\n' ?
>
> tr substitutes characters only, while sed can work on arbitrary strings and
> patterns. My guess is that the example was a simplified expression of a more
> general requirement, in which case sed is appropriate and therefor
http://www.faqs.org/faqs/editor-faq/sed/
section 4.6
on Do, Nov 07, 2002 at 03:46:25pm -0500, Mathew Kanner wrote:
> Hello,
> I've been going nuts trying to figure out how to embed a
> newline in sed, and the man page just doesn't mean anything to me.
>
> What I would like is
> echo a
> How about echo abc | tr 'b' '\n' ?
tr substitutes characters only, while sed can work on arbitrary strings and
patterns. My guess is that the example was a simplified expression of a more
general requirement, in which case sed is appropriate and therefore,
echo aaabbbccc | sed -e 's,bbb,\
,'
w
On 11/7/02 12:46 PM, "Mathew Kanner" <[EMAIL PROTECTED]> wrote:
> What I would like is
> echo abc | sed -e's,b,\n' to get
> a
> c
A script of the form:
echo abc | sed -e 's,b,\
,'
will work if the newline is escaped with a backslash and the remainder of
the sed substitute is on the next line.
On Thu, 7 Nov 2002 15:46:25 -0500
Mathew Kanner <[EMAIL PROTECTED]> wrote:
Hi,
> I've been going nuts trying to figure out how to embed a
> newline in sed, and the man page just doesn't mean anything to me.
>
> What I would like is
> echo abc | sed -e's,b,\n' to get
> a
>
Hello,
I've been going nuts trying to figure out how to embed a
newline in sed, and the man page just doesn't mean anything to me.
What I would like is
echo abc | sed -e's,b,\n' to get
a
c
Of course, the above doesn't work and I'm looking for an
alternativ
55 matches
Mail list logo