Re: sed question

2019-12-07 Thread Michael
On Friday, December 6, 2019 6:06:10 PM CET, songbird wrote: result=`echo "summary: \"\"" | sed -e "s/^summary: .*$/summary: \"${old_summary}\"/"` of course this doesn't work. since you use '/' (slash) as delimiter in the sed expression, the slash in $old_summary is interpreted as the delimite

Re: sed question

2019-12-07 Thread Andrei POPESCU
On Vi, 06 dec 19, 14:50:51, Greg Wooledge wrote: > On Fri, Dec 06, 2019 at 02:40:49PM -0500, songbird wrote: > > Greg Wooledge wrote: > > ... > > > Ideally, you'd just stop trying to use sed with user-supplied variables > > > injected into the code. Sed was never built to be safe for that kind of

Re: sed question

2019-12-07 Thread Andrei POPESCU
On Vi, 06 dec 19, 14:40:49, songbird wrote: > > the point of doing something in bash is to do it quick and > see if the concept is useful enough. if enough people decide > to use it then it can be more formalized. We often build prototypes / proof-of-concept / experiments that live much longe

Re: sed question

2019-12-07 Thread Jeremy Nicoll
On Sat, 7 Dec 2019, at 14:20, songbird wrote: > The Wanderer wrote: > > ... about various characters and then @ in particular ... > > > As far as I can see, at least on my keyboard, that pretty much just > > leaves @. It does still sometimes occur in paths and filenames, so it's > > not really i

Re: Alternate delimiters (for sed) above decimal 127? (was Re: sed question)

2019-12-07 Thread David Wright
On Sat 07 Dec 2019 at 09:27:59 (-0500), rhkra...@gmail.com wrote: > On Saturday, December 07, 2019 07:20:35 AM The Wanderer wrote: > > Yep - using '/' is only a standard convention, it's not required. When > > writing an s-expression which I know will be passed a path, I generally > > use '@' mysel

Re: sed question

2019-12-07 Thread songbird
Andrei POPESCU wrote: ... pre processing for that one character using a different delimiter and then processing the results of that with the original delimiter seems to cover everything i'm worried about. :) > One trick to avoid this problems is to use a different delimiter, e.g. '|'. > > Acco

Re: sed question

2019-12-07 Thread songbird
The Wanderer wrote: ... about various characters and then @ in particular ... > As far as I can see, at least on my keyboard, that pretty much just > leaves @. It does still sometimes occur in paths and filenames, so it's > not really ideal, but it's probably less common there than any of the >

Alternate delimiters (for sed) above decimal 127? (was Re: sed question)

2019-12-07 Thread rhkramer
On Saturday, December 07, 2019 07:20:35 AM The Wanderer wrote: > Yep - using '/' is only a standard convention, it's not required. When > writing an s-expression which I know will be passed a path, I generally > use '@' myself; that A: is conveniently typable on the keyboard, B: is a > comparativel

Re: sed question

2019-12-07 Thread The Wanderer
On 2019-12-07 at 04:43, Andrei POPESCU wrote: > On Vi, 06 dec 19, 16:15:51, songbird wrote: > >> The Wanderer wrote: >>> >>> For example, 's/hello/newstring/' would be a valid sed >>> 's'-expression, but 's/a/b/newstring/' would not; the former >>> contains three instances of the delimiting toke

Re: sed question

2019-12-07 Thread Andrei POPESCU
On Vi, 06 dec 19, 16:15:51, songbird wrote: > The Wanderer wrote: > > > > For example, 's/hello/newstring/' would be a valid sed 's'-expression, > > but 's/a/b/newstring/' would not; the former contains three instances of > > the delimiting token, which is valid, but the former contains four, > > w

Re: sed question

2019-12-06 Thread songbird
Erik Christiansen wrote: ... > If the sed implementation of variable regexes proves problematic, then > there's awk with its Dynamic Regexps. (Section 2.8 of the pdf manual > floating about out there.) > > With its C-like syntax, it's less write-only than perl, perhaps because > it is of the same v

Re: sed question

2019-12-06 Thread Erik Christiansen
On 06.12.19 14:40, songbird wrote: > Greg Wooledge wrote: > ... > > Ideally, you'd just stop trying to use sed with user-supplied variables > > injected into the code. Sed was never built to be safe for that kind of > > work. > > sed was designed to operate on streams. a sequence of > charact

Re: sed question

2019-12-06 Thread songbird
Greg Wooledge wrote: ... > If you insist on doing #1, so be it. It's your damned computer, and your > damned problem. I can only warn you and be ignored so many times > before I give up and let your fuck yourself, as you so vehemently and > stubbornly eager to do. i appreciate the actual expla

Re: sed question

2019-12-06 Thread songbird
The Wanderer wrote: >songbird wrote: ... >> sed was designed to operate on streams. a sequence of characters is >> a stream. i don't see any reason why putting the variable into the >> middle of that expression means anything different. > > Because sed doesn't see the variable; the variable is ha

Re: sed question

2019-12-06 Thread The Wanderer
On 2019-12-06 at 14:40, songbird wrote: > Greg Wooledge wrote: ... >> Ideally, you'd just stop trying to use sed with user-supplied >> variables injected into the code. Sed was never built to be safe >> for that kind of work. > > sed was designed to operate on streams. a sequence of characters

Re: sed question

2019-12-06 Thread Greg Wooledge
On Fri, Dec 06, 2019 at 02:40:49PM -0500, songbird wrote: > Greg Wooledge wrote: > ... > > Ideally, you'd just stop trying to use sed with user-supplied variables > > injected into the code. Sed was never built to be safe for that kind of > > work. > > sed was designed to operate on streams. a

Re: sed question

2019-12-06 Thread songbird
Greg Wooledge wrote: ... > Ideally, you'd just stop trying to use sed with user-supplied variables > injected into the code. Sed was never built to be safe for that kind of > work. sed was designed to operate on streams. a sequence of characters is a stream. i don't see any reason why putti

Re: sed question

2019-12-06 Thread Greg Wooledge
On Fri, Dec 06, 2019 at 12:06:10PM -0500, songbird wrote: > #this doesn't work... > old_summary=`echo "Previous glitches and inconsistencies were due to a > missing / at the end of the baseurl... ,.#*$+%*$&#+(*={_})"` > result=`echo "summary: \"\"" | sed -e "s/^summary: .*$/summary: > \"${old_s

sed question

2019-12-06 Thread songbird
hi, please reply to the list only... here is my script fragment: = #!/bin/bash #this doesn't work... echo -e "\n\nThis doesn't work.\n\n" old_summary=`echo "Previous glitches and inconsistencies were due to a missing / at the end of the baseurl... ,.#*$+%*$&#+(*={_})"` echo "Summary -

Re: sed question.

2004-06-04 Thread Matthijs
On Fri, 04 Jun 2004 17:30:28 +0200, Ralph Crongeyer <[EMAIL PROTECTED]> wrote: > Carlos Hanson wrote: > > >On Fri, 04 Jun 2004 10:31:07 -0400 > >Ralph Crongeyer <[EMAIL PROTECTED]> wrote: > > > >>I need to do a pattern match with sed of "(" and ")". I need to replace > >>every ( with "(" and ev

Re: sed question.

2004-06-04 Thread Carlos Hanson
On Fri, 04 Jun 2004 11:28:50 -0400 Ralph Crongeyer <[EMAIL PROTECTED]> wrote: > Carlos Hanson wrote: > > >On Fri, 04 Jun 2004 10:31:07 -0400 > >Ralph Crongeyer <[EMAIL PROTECTED]> wrote: > > > > > > > >>Hi all, > >>I need to do a pattern match with sed of "(" and ")". I need to > >replace >eve

Re: sed question.

2004-06-04 Thread Ralph Crongeyer
Carlos Hanson wrote: On Fri, 04 Jun 2004 10:31:07 -0400 Ralph Crongeyer <[EMAIL PROTECTED]> wrote: Hi all, I need to do a pattern match with sed of "(" and ")". I need to replace every ( with "(" and every ) with ")" on every line. Can someone help me with this? Thanks Ralph

Re: sed question.

2004-06-04 Thread Carlos Hanson
On Fri, 04 Jun 2004 10:31:07 -0400 Ralph Crongeyer <[EMAIL PROTECTED]> wrote: > Hi all, > I need to do a pattern match with sed of "(" and ")". I need to replace > every ( with "(" and every ) with ")" on every line. > > Can someone help me with this? > > Thanks > > Ralph > sed 's/[()]/"&"/

sed question.

2004-06-04 Thread Ralph Crongeyer
Hi all, I need to do a pattern match with sed of "(" and ")". I need to replace every ( with "(" and every ) with ")" on every line. Can someone help me with this? Thanks Ralph -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: sed question

2003-09-03 Thread John Habermann
thanks Carlos, that works great. I think I am beginning to get grasp regular expression syntax now. Thanks very much for you help John On Sun, 31 Aug 2003 14:05:38 +0100 Carlos Sousa <[EMAIL PROTECTED]> wrote: > On Sun, 31 Aug 2003 22:38:58 +1000 John Habermann wrote: > > I tried": > > > >

Re: sed question

2003-08-31 Thread Carlos Sousa
On Sun, 31 Aug 2003 22:38:58 +1000 John Habermann wrote: > I tried": > > cat temp | sed 's/^[[:alpha:]]*[[:space:]]*//' > log > > Where temp is: > > test.wilderness.org.au/about_us/whatistwsck 203.48.59.163 - - > [26/Aug/2003 08:14:01] "GET > http://test.wilderness.org.au/about_us/whatistws HT

Re: sed question

2003-08-31 Thread John Habermann
Hi Carlos Thanks for your help. On Sun, 31 Aug 2003 02:10:14 +0100 Carlos Sousa <[EMAIL PROTECTED]> wrote: > On Sun, 31 Aug 2003 10:20:46 +1000 John Habermann wrote: > > I have tried things like the following: > > > > sed -e 's/^w.*\s//' > log > > > > thinking that it would delete from the be

Re: sed question

2003-08-31 Thread Ron Johnson
On Sun, 2003-08-31 at 07:38, John Habermann wrote: > Hi Carlos > > Thanks for your help. > > > On Sun, 31 Aug 2003 02:10:14 +0100 > Carlos Sousa <[EMAIL PROTECTED]> wrote: > > > On Sun, 31 Aug 2003 10:20:46 +1000 John Habermann wrote: > > > I have tried things like the following: > > > > > > s

Re: sed question

2003-08-31 Thread Johan Braennlund
In article <[EMAIL PROTECTED]> you wrote: > I tried: > cat temp | sed 's/^[[:alpha:]]*[[:space:]]*//' > log > Where temp is: > test.wilderness.org.au/about_us/whatistwsck > 203.48.59.163 - - [26/Aug/2003 08:14:01] "GET > http://test.wilderness.org.au/about_us/whatistws HTTP/1.0" 200 20872 "-"

Re: sed question

2003-08-31 Thread Alvin Oga
hi ya john change your /etc/httpd/conf/httpd Server www.domain-A.com TransferLog logs/access_log.A ... Server www.domain-B.com TransferLog logs/access_log.B ... Server www.domain-C.com TransferLog

Re: sed question

2003-08-31 Thread Carlos Sousa
On Sun, 31 Aug 2003 10:20:46 +1000 John Habermann wrote: > I have tried things like the following: > > sed -e 's/^w.*\s//' > log > > thinking that it would delete from the beginning of the line to the > first white space but it deletes all matched expressions. (man sed, man grep) It seems you m

sed question

2003-08-31 Thread John Habermann
Hi I am just beginning to learn how to use sed in order to sort my squid log files by virtualhost and am having trouble getting my head around how the regular expression works. I can sort my log files into the different virtual hosts using grep eg "grep '^test' access-sed.txt > test.wilderne

Re: a sed question

2002-01-25 Thread Karl E. Jorgensen
On Fri, Jan 25, 2002 at 03:13:22PM -0100, andrej hocevar wrote: > Hello, > can someone please tell me how to instruct sed to make an empty line > before a certain pattern? For me, the same would be to make a new > line every N lines. > Thank you. > > e.g. > > Package: foo > Pin: bar > > Package

a sed question

2002-01-25 Thread andrej hocevar
Hello, can someone please tell me how to instruct sed to make an empty line before a certain pattern? For me, the same would be to make a new line every N lines. Thank you. e.g. Package: foo Pin: bar Package: ... etc ...

Re: sed question

2001-03-29 Thread will trillich
On Wed, Mar 28, 2001 at 10:42:44PM -0600, [EMAIL PROTECTED] wrote: > I need a sed invocation to extract quotes (") from around a string. > > Basicly `cat /etc/bind/named.conf | grep zone | cut -d " " | sed $something' > > to give me a list of zones I run bind for so I can: > for zone in `$sedcsri

sed question

2001-03-28 Thread klong
I need a sed invocation to extract quotes (") from around a string. Basicly `cat /etc/bind/named.conf | grep zone | cut -d " " | sed $something' to give me a list of zones I run bind for so I can: for zone in `$sedcsript` do $SOME $zone $MANAGENENT done or if there is a

Re: sed question (bibtex problem)

2000-11-07 Thread Brian May
> "Daniel" == Daniel Reuter <[EMAIL PROTECTED]> writes: Daniel> It should work from command line using bash's multiline Daniel> input capability (with the '). It checks for % at the end Daniel> of lines (hence the $), then reads the next line into the Daniel> buffer and then re

Re: sed question (bibtex problem)

2000-11-05 Thread Daniel Reuter
Hello Brian, Check this: sed '/%$/{ N s/%\n// }' yourfile.bib It should work from command line using bash's multiline input capability (with the '). It checks for % at the end of lines (hence the $), then reads the next line into the buffer and then removes the %\n sequence (I don't quite unders

Re: sed question

2000-11-03 Thread Jesse Goerz
On Fri, 03 Nov 2000, Andrei Pelinescu - Onciul wrote: > Jesse Goerz wrote: > > > > I'm trying to write a script and as part of it I need to change the "/" in a > > variable to a "." and then put it right back into another variable. I've > > tried > > using sed but can't seem to grip these regula

Re: sed question

2000-11-03 Thread Andrei Pelinescu - Onciul
Jesse Goerz wrote: > > I'm trying to write a script and as part of it I need to change the "/" in a > variable to a "." and then put it right back into another variable. I've > tried > using sed but can't seem to grip these regular expressions 8-(. Here's what I > got so far: > > echo $variabl

Re: sed question

2000-11-03 Thread Ethan Benson
On Fri, Nov 03, 2000 at 08:10:48AM -0500, Jesse Goerz wrote: > I'm trying to write a script and as part of it I need to change the "/" in a > variable to a "." and then put it right back into another variable. I've > tried > using sed but can't seem to grip these regular expressions 8-(. Here's

sed question

2000-11-03 Thread Jesse Goerz
I'm trying to write a script and as part of it I need to change the "/" in a variable to a "." and then put it right back into another variable. I've tried using sed but can't seem to grip these regular expressions 8-(. Here's what I got so far: echo $variable_before | sed s///./ variable_after

Re: sed question (bibtex problem)

2000-11-02 Thread Damian Menscher
On Fri, 3 Nov 2000, Brian May wrote: > bibtex likes to word-wrap/mangle/destroy my long lines (eg. URLs) into > this form: > > \bibitem[Mic00]{Microsoft2000} > Microsoft. > \newblock Windows 2000 kerberos authentication. > \newblock White paper, Microsoft, January 2000. > \newblock > > \url=ht

sed question (bibtex problem)

2000-11-02 Thread Brian May
If I have a file with the following format: a% ss j% ddd how do I tell sed (or another program) to remove the % and \n character at the end of each line. ie. something like sed 's/%\n//' but that doesn't work :-( The reason: bibtex li

Re: SED question

1999-10-22 Thread Greg Wooledge
Andrew Hately ([EMAIL PROTECTED]) wrote: > Back quotes can't be nested, while $( ) does the same job and can be nested Actually, you can nest backquotes as long as you \-escape them. $( ) is great, but if you're ever going to use a traditional Bourne shell, you won't be able to use it -- so make

Re: SED question

1999-10-21 Thread Andrew Hately
Ben Lutgens wrote: > > I had to use the back quotes`` Back quotes can't be nested, while $( ) does the same job and can be nested -- http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=45690

Re: SED question

1999-10-21 Thread Etienne Grossmann
Hello, > I am writing a shell script using sed I need to figure out how I can store the > output of > > grep florida roam.db | sed -e "s/^.*\? //g" > > to a variable. roam.db has entries like, one per line. > > florida: 555-1212 you mean, in a shell variable? In bash and maybe sh this should

Re: SED question

1999-10-21 Thread Ben Lutgens
On Thu, Oct 21, 1999 at 03:36:01AM -0500, Eric Gillespie, Jr. wrote: > > Those are backticks (`), not apostrophes ('). Thanx, figured it out, and man did I feel like a dummy. About 15 minutes after I sent off the e-mail. Nevermind that I tried everything for an hour or two and read and read all d

Re: SED question

1999-10-21 Thread Ben Lutgens
On Thu, Oct 21, 1999 at 09:53:26AM +0200, Andrew Hately wrote: > What do you want in the variable? Multiple lines? > Did you try > set foo=$( grep florida roam.db | sed -e "s/^.*\? //g" ) > Whats the greater context? > Andrew > I finally got it with export GREP_RESULT=`grep $LOCATION $HOME/roam.db

Re: SED question

1999-10-21 Thread Eric Gillespie, Jr.
On Wed, Oct 20, 1999 at 11:37:26PM -0800, Ben Lutgens <[EMAIL PROTECTED]> wrote: > I am writing a shell script using sed I need to figure out how I can store the > output of > > grep florida roam.db | sed -e "s/^.*\? //g" > > to a variable. roam.db has entries like, one per line. value=`grep fl

SED question

1999-10-21 Thread Ben Lutgens
I am writing a shell script using sed I need to figure out how I can store the output of grep florida roam.db | sed -e "s/^.*\? //g" to a variable. roam.db has entries like, one per line. florida: 555-1212 Any help would be greatly appreciated.