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 delimiter, 
and the rest (everything after the third slash doesn't make any sense to 
sed.


in this case, you have to escape all slashes in $old_summary to allow sed 
to do what you want.


try this:

result=`echo "summary: \"\"" | sed -e "s/^summary: .*$/summary: 
\"${old_summary//\//\\\/}\"/"`


greetings...



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
> > > work.
> > 
> >   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.
> 
> It was designed to accept a program in argv[] and execute that program
> on its input, which is a stream.
> 
> You are injecting your end-user variables inside sed's program.  This
> is called code injection.  End-user data is being parsed as code by
> a code interpreter (in this case, sed).
> 
> The workarounds for this are:
> 
> 1) Carefully quote/dequote/escape/mangle the end-user data so that
>after it has been injected into the code, it will achieve the desired
>goal.
> 
> 2) Use some other tool or method of supplying the end-user data so that
>it is never parsed as code by any interpreter.

As usual, your posts are very valuable. I will openly admit I have 
learned a lot from them (as well as from your wiki).
 
> 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.

This last paragraph could have been left out though.

Using such language will only diminish the value of / distract from the 
valuable explanations above.

You can't save them all :)

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser


signature.asc
Description: PGP signature


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 longer than originally intended.

It's a good idea to do it right from the start and not suffer the 
consequences later (sometimes many years later) and at a much bigger 
scale.

An extreme example:
https://networkengineering.stackexchange.com/questions/7928/why-are-ipv4-addresses-32-bit

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser


signature.asc
Description: PGP signature


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 ideal, but it's probably less common there than any of the
> > non-special-meaning others.
> 
>   my specific use wasn't for paths or file names but text in
> general which i'd previously typed in as a summary.  so rarely
> any special characters in there at all (other than the end of
> line characters).  it was always delimited by triple "'s so i
> had to split that chunk to get rid of those.

On other systems I've got around this by translating the strings to a 
hex representation, then issued the command in hex terms, so eg 
instead of 

  this = "first string"
  that = "new value"
 "c /"this"/"that"/"

I've had 

  thishex =  c2x(this) ie: "666972737420737472696E67"
  thathex = c2x(that)ie: "6E65772076616C7565"

"c /'"thishex"'/'"thathex"'/"

which is to say 

"c /'666972737420737472696E67'/'6E65772076616C7565'/"



-- 
Jeremy Nicoll - my opinions are my own.



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 '@' myself; that A: is conveniently typable on the keyboard, B: is a
> > comparatively rare character to find in either path or filename, C:
> > doesn't have special meaning as part of a regular expression, and D:
> > unlike most of the other characters that fit the other criteria, isn't
> > treated specially by most shells that I know of.
> > 
> > 
> > `~!#$&*()={}|\;"'<> are all treated specially by bash, in at least some
> > circumstances. (Assuming I haven't mixed anything up.)
> > 
> > $^*()+[]|\.? are treated specially as part of a regular expression.
> > 
> > !%&()_+=-:;'",./? are comparatively common in paths and/or filenames.
> > 
> > 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
> > non-special-meaning others.
> 
> I'm not the OP, but thanks for the explanation / discussion.
> 
> I just have a wild idea / question.  Those are (iirc) all ASCII characters, 
> (basically 7 bits) (yes, I know they are in an 8 bit byte), I wonder if SED 
> (and AWK) could use something in, well, is it called the 2nd code page (I 
> forget), but some character like the degree symbol (which, iirc, is something 
> like 240 octal?).  Also, although I haven't used it in a very long time, it 
> seems there is (or was) a means to do something like type 240 to 
> actually 
> enter the degree sign.

I won't speak to awk, but sed requires the delimiters to be single
bytes.  A "penalty" for using utf8 throughout the system is that the
top bit has to be 0 in single byte characters because setting the
top bit indicates there's at least one more byte in the character.

> Oh, hmm, 240 doesn't do it, maybe something has changed (or, more 
> likely, 
> I'm mis-remembering ;-)

If *my* memory serves, isn't that how M$ systems used to enter
characters? Anyway, you can make things a lot easier for yourself
by defining characters in a way that makes sense to you. For example,
I use degrees ° quite often and type it with three keystrokes:
  
I rely on the defaults (wherever they originate) as much as possible
(they seem to make sense), but I add quite a lot more, and have
endeavoured to make VCs and X behave similarly:

https://lists.debian.org/debian-user/2019/07/msg00926.html

Cheers,
David.



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. '|'.
>
> According to the manual[1][2] any other character is accepted.
>
> [1] https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command
> [2] as with many (most? all?) GNU programs the full documentation is=20
> available only as a Texinfo manual, not a man page.

  yeah...


  songbird



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
> non-special-meaning others.

  my specific use wasn't for paths or file names but text in
general which i'd previously typed in as a summary.  so rarely
any special characters in there at all (other than the end of
line characters).  it was always delimited by triple "'s so i
had to split that chunk to get rid of those.


  songbird



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
> comparatively rare character to find in either path or filename, C:
> doesn't have special meaning as part of a regular expression, and D:
> unlike most of the other characters that fit the other criteria, isn't
> treated specially by most shells that I know of.
> 
> 
> `~!#$&*()={}|\;"'<> are all treated specially by bash, in at least some
> circumstances. (Assuming I haven't mixed anything up.)
> 
> $^*()+[]|\.? are treated specially as part of a regular expression.
> 
> !%&()_+=-:;'",./? are comparatively common in paths and/or filenames.
> 
> 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
> non-special-meaning others.

I'm not the OP, but thanks for the explanation / discussion.

I just have a wild idea / question.  Those are (iirc) all ASCII characters, 
(basically 7 bits) (yes, I know they are in an 8 bit byte), I wonder if SED 
(and AWK) could use something in, well, is it called the 2nd code page (I 
forget), but some character like the degree symbol (which, iirc, is something 
like 240 octal?).  Also, although I haven't used it in a very long time, it 
seems there is (or was) a means to do something like type 240 to actually 
enter the degree sign.

Oh, hmm, 240 doesn't do it, maybe something has changed (or, more likely, 
I'm mis-remembering ;-)



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 token, which is valid,
>>> but the former contains four, which is not.
>>> 
>>> If you have the sed expression 's/${oldstring}/newstring/', and
>>> you define oldstring as having the value 'hello' then sed sees
>>> the first expression, and you get the good result.
>>> 
>>> But if you instead define oldstring as having the value 'a/b',
>>> then sed sees the second expression, and you get a syntax error.
>>> 
>>> 
>>> (Assuming I'm not mixing things up right now, anyway.)
>> 
>> :)  thank you for your reply.  now i see it.
> 
> One trick to avoid this problems is to use a different delimiter,
> e.g. '|'.

That doesn't actually avoid the problem; it just moves it. If the user
input includes the new delimiter, you have the same problem again.

This may still be useful in practice, since some delimiters are more
likely to be common in non-malicious input than others, but it just
reduces the likelihood of triggering the problem - it doesn't eliminate
it entirely.

> According to the manual[1][2] any other character is accepted.

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
comparatively rare character to find in either path or filename, C:
doesn't have special meaning as part of a regular expression, and D:
unlike most of the other characters that fit the other criteria, isn't
treated specially by most shells that I know of.


`~!#$&*()={}|\;"'<> are all treated specially by bash, in at least some
circumstances. (Assuming I haven't mixed anything up.)

$^*()+[]|\.? are treated specially as part of a regular expression.

!%&()_+=-:;'",./? are comparatively common in paths and/or filenames.

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
non-special-meaning others.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw



signature.asc
Description: OpenPGP digital signature


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,
> > which is not.
> >
> > If you have the sed expression 's/${oldstring}/newstring/', and you
> > define oldstring as having the value 'hello' then sed sees the first
> > expression, and you get the good result.
> >
> > But if you instead define oldstring as having the value 'a/b', then sed
> > sees the second expression, and you get a syntax error.
> >
> >
> > (Assuming I'm not mixing things up right now, anyway.)
> 
>   :)  thank you for your reply.  now i see it.

One trick to avoid this problems is to use a different delimiter, e.g. '|'.

According to the manual[1][2] any other character is accepted.

[1] https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command
[2] as with many (most? all?) GNU programs the full documentation is 
available only as a Texinfo manual, not a man page.

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser


signature.asc
Description: PGP signature


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 vintage as sed. (And from the same stable.) It does
> admittedly tend to view its input stream a line at the time.

  i've used gawk in a different part of my script but not for 
pattern matching and replacement.  as this is an aside i won't
post a fully working fragment, but the following were pretty handy
for breaking a file apart so i could get at the chunks i needed
without having to write something more complicated to do it.

gawk -v RS='+++\n' -v ORS= '{print > "zzzpart"NR}' zzzoldall
gawk -v RS='\"\"\"\n' -v ORS= '{print > "zzzsumm"NR}' zzzoldall

the first one was for files with +++ marking the beginning and
ending of a header section and the second was for lines surrounded
by """ 's.


  songbird



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 
> characters is a stream.  i don't see any reason why 
> putting the variable into the middle of that expression 
> means anything different.

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 vintage as sed. (And from the same stable.) It does
admittedly tend to view its input stream a line at the time.

Erik



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 explanations given, but your level of
drama queen is hysterical.

  note, if i am preprocessing said string to deal with that
specific character then there is no issue to be worried
about.  this isn't a production system facing the wider world.

  and thanks for ignoring what else i said.


  songbird



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 handled by the
> shell. sed only sees the result of expanding the variable.
>
> If the variable doesn't contain the delimiting token (the character
> after the initial 's' - in this case, '/'), then things work out fine.
>
> But if the variable does contain that token, then what sed sees contains
> too many instances of that token, and the result is invalid sed syntax -
> so sed errors out, because it doesn't know what to do with what it saw.
>
>
> 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,
> which is not.
>
> If you have the sed expression 's/${oldstring}/newstring/', and you
> define oldstring as having the value 'hello' then sed sees the first
> expression, and you get the good result.
>
> But if you instead define oldstring as having the value 'a/b', then sed
> sees the second expression, and you get a syntax error.
>
>
> (Assuming I'm not mixing things up right now, anyway.)

  :)  thank you for your reply.  now i see it.


  songbird



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 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 handled by the
shell. sed only sees the result of expanding the variable.

If the variable doesn't contain the delimiting token (the character
after the initial 's' - in this case, '/'), then things work out fine.

But if the variable does contain that token, then what sed sees contains
too many instances of that token, and the result is invalid sed syntax -
so sed errors out, because it doesn't know what to do with what it saw.


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,
which is not.

If you have the sed expression 's/${oldstring}/newstring/', and you
define oldstring as having the value 'hello' then sed sees the first
expression, and you get the good result.

But if you instead define oldstring as having the value 'a/b', then sed
sees the second expression, and you get a syntax error.


(Assuming I'm not mixing things up right now, anyway.)

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw



signature.asc
Description: OpenPGP digital signature


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

It was designed to accept a program in argv[] and execute that program
on its input, which is a stream.

You are injecting your end-user variables inside sed's program.  This
is called code injection.  End-user data is being parsed as code by
a code interpreter (in this case, sed).

The workarounds for this are:

1) Carefully quote/dequote/escape/mangle the end-user data so that
   after it has been injected into the code, it will achieve the desired
   goal.

2) Use some other tool or method of supplying the end-user data so that
   it is never parsed as code by any interpreter.

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.



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 
putting the variable into the middle of that expression 
means anything different.


> There are some alternatives at 
> including one using perl which handles arbitrary user-supplied search
> and replace variables safely.

  no thanks.  if i want to get all formal i'd either write a
parser/lexical analyzer and a C program or python.  i've never
needed to use perl before and don't plan on picking it up now
for such a minor thing as the script i've been working on (that
the fragment is a part of).

  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.


  songbird



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

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

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.

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/[()]//g'

Here is the test I used:

$ echo This (is) a (test) of (()) | sed 's/[()]//g'  
This (is) a (test) of (())


-- 
Carlos Hanson
Webmaster and Postmaster
Tigard-Tualatin School District

ph: 503.431.4053


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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


  
  
sed 's/[()]/""/g'

Here is the test I used:

$ echo "This (is) a (test) of (())" | sed 's/[()]/""/g'  
This "("is")" a "("test")" of "(""("")"")"


  

Carlos, Thanks!
By the way, what does the  mean?

Ralph




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 every ( with ( and every ) with ) on every line.
 
 
 sed 's/[()]//g'
 
 
 Carlos, Thanks!
 By the way, what does the  mean?
 
 Ralph
 

It refers to the portion of the pattern space which matched.  Quoted
from the sed man page.

-- 
Carlos Hanson
Webmaster and Postmaster
Tigard-Tualatin School District

ph: 503.431.4053


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 every ) with ) on every line.
 
 sed 's/[()]//g'
 
 Carlos, Thanks!
 By the way, what does the  mean?

Substitute the previously found string. So in this case, sed will
search (letter 's') for either a ( or a ) (character class [()]) and
replace it with a double quote, the previously found open or close
bracket and another double quote.

My advice: do some reading on regular expressions. For me, the book
'mastering regular expressions' by O'Reilly was really helpful.
There's SO much that you can do more effectively with regular
expressions and sed...

Last week, I had to extract a few lines of useful information from an
850MB logfile. My favorite editor (NEdit) had some memory problems and
refused to open it, but a small awk-program and a lot of regular
expressions with sed and grep got the job done in a matter of minutes.

-- 
Matthijs
[EMAIL PROTECTED]


-- 
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: 
  
  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
  - Dillo/0.7.3 TCP_MISS:DIRECT
  
  but that just removes the test from .wilderness 
 
 That's right, [:alpha:] only gets letters, and [:alnum:] letters and
 digits, missing the dots, slashes, etc. This will work:
 
sed 's/^[^[:space:]]*[[:space:]]*//'
 
 meaning 'scrap all non-blanks and following blanks, from the start of
 the line.
 
  I thought I would
  be able to use grep and sed to do the job for me and I can use grep to
  filter them in separate log files but I now need to delete that first
  virtual host entry so I can use webalizer to analyse the seperate log
  files. I have read the info page for sed and looked at tutorials and
  the faq but haven't seen been able to really understand the options.
 
 Don't worry, it comes with practice
 
 Cheers,
 
 -- 
 Carlos Sousa
 http://vbc.dyndns.org/
 
 
 -- 
 To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
 with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
 
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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.wilderness.log as I have got squid to write the logs with the 
virtualhost entry added to the front of every log entry as illustrated below. What I 
am having problems with is using sed to strip the virtualhost entry from the front of 
the log entrys once they have been sorted so I can then use webalizer to analyse the 
logs for me and get different webalizer reports for different virtual hosts.

www.sydney.wilderness.org.au/docs/node.php? 203.48.59.163 - - [26/Aug/2003 08:09:56] 
GET http://www.sydney.wilderness.org.au/docs/node.php? HTTP/1.1 200 8719 
http://www.sydney.wilderness.org.au/docs/module.php?mod=book; Mozilla/5.0 (X11; U; 
Linux ppc) Gecko/20030714 Galeon/1.3.7 Debian/1.3.7.20030723-1 TCP_MISS:DIRECT

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. I was wondering how I could get sed to just 
match the first expression or is there a better way to do this. I am having a bit of 
trouble understanding exactly how regular expressions work in sed.

Thanks for any help

John



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 mean 's/^\w*\s//'

Unfortunately, it seems sed doesn't understand the \w and \s escape
sequences, unlike grep. Better try:

   sed 's/^[[:alnum:]]*[[:space:]]*//'

-- 
Carlos Sousa
http://vbc.dyndns.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 logs/access_log.C

than merge the data you like from each url
from each virtual server

c ya
alvin

w/ sed .. you wanna delete leading a-z, 0-9 and   and / and .
and _ and any other legal chars you used in your virtual domains .. 
so the ^  is good  .. its gonna get very messy

On Sun, 31 Aug 2003, 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:
   
   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 mean 's/^\w*\s//'
  
  Unfortunately, it seems sed doesn't understand the \w and \s escape
  sequences, unlike grep. Better try:
  
 sed 's/^[[:alnum:]]*[[:space:]]*//'
 
 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 - 
 Dillo/0.7.3 TCP_MISS:DIRECT
 
 but that just removes the test from .wilderness 
 
 What I want to do is to go through a log file and delete all the virtual host 
 entries at the front of each log entry so I end up with something like this. 
 
 203.48.59.163 - - [26/Aug/2003 08:14:01] GET 
 http://test.wilderness.org.au/about_us/whatistws HTTP/1.0 200 20872 - 
 Dillo/0.7.3 TCP_MISS:DIRECT
 
 I just can't seem to figure out how to match that first virtual host path and 
 delete. I have seen perl scripts written to sort virtual hosts into separate log 
 files for apache but they don't seem to work for the logs that are produced by squid 
 and I don't have any perl knowledge so looking at the scripts didn't help me. I 
 thought I would be able to use grep and sed to do the job for me and I can use grep 
 to filter them in separate log files but I now need to delete that first virtual 
 host entry so I can use webalizer to analyse the seperate log files. I have read the 
 info page for sed and looked at tutorials and the faq but haven't seen been able to 
 really understand the options.
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 - 
 Dillo/0.7.3 TCP_MISS:DIRECT

 but that just removes the test from .wilderness 

If you don't mind using awk instead of sed, try 

cat temp |awk '$1=;{print}'

Regards,

Johan


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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:
   
   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 mean 's/^\w*\s//'
  
  Unfortunately, it seems sed doesn't understand the \w and \s escape
  sequences, unlike grep. Better try:
  
 sed 's/^[[:alnum:]]*[[:space:]]*//'
 
 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 - 
 Dillo/0.7.3 TCP_MISS:DIRECT
 
 but that just removes the test from .wilderness 
 
 What I want to do is to go through a log file and delete all the virtual host 
 entries at the front of each log entry so I end up with something like this. 
 
 203.48.59.163 - - [26/Aug/2003 08:14:01] GET 
 http://test.wilderness.org.au/about_us/whatistws HTTP/1.0 200 20872 - 
 Dillo/0.7.3 TCP_MISS:DIRECT
 
 I just can't seem to figure out how to match that first virtual host path and 
 delete. I have seen perl scripts written to sort virtual hosts into separate log 
 files for apache but they don't seem to work for the logs that are produced by squid 
 and I don't have any perl knowledge so looking at the scripts didn't help me. I 
 thought I would be able to use grep and sed to do the job for me and I can use grep 
 to filter them in separate log files but I now need to delete that first virtual 
 host entry so I can use webalizer to analyse the seperate log files. I have read the 
 info page for sed and looked at tutorials and the faq but haven't seen been able to 
 really understand the options.

If the delimiter is the 1st space character, how about using cut(1)?

-- 
-
Ron Johnson, Jr. [EMAIL PROTECTED]
Jefferson, LA USA

Thanks to the good people in Microsoft, a great deal of the data 
that flows is dependent on one company. That is not a healthy 
ecosystem. The issue is that creativity gets filtered through 
the business plan of one company.
Mitchell Baker, Chief Lizard Wrangler at Mozilla


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 beginning of the line to the
  first white space but it deletes all matched expressions.
 
 (man sed, man grep)
 
 It seems you mean 's/^\w*\s//'
 
 Unfortunately, it seems sed doesn't understand the \w and \s escape
 sequences, unlike grep. Better try:
 
sed 's/^[[:alnum:]]*[[:space:]]*//'

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 - 
Dillo/0.7.3 TCP_MISS:DIRECT

but that just removes the test from .wilderness 

What I want to do is to go through a log file and delete all the virtual host entries 
at the front of each log entry so I end up with something like this. 

203.48.59.163 - - [26/Aug/2003 08:14:01] GET 
http://test.wilderness.org.au/about_us/whatistws HTTP/1.0 200 20872 - Dillo/0.7.3 
TCP_MISS:DIRECT

I just can't seem to figure out how to match that first virtual host path and delete. 
I have seen perl scripts written to sort virtual hosts into separate log files for 
apache but they don't seem to work for the logs that are produced by squid and I don't 
have any perl knowledge so looking at the scripts didn't help me. I thought I would be 
able to use grep and sed to do the job for me and I can use grep to filter them in 
separate log files but I now need to delete that first virtual host entry so I can use 
webalizer to analyse the seperate log files. I have read the info page for sed and 
looked at tutorials and the faq but haven't seen been able to really understand the 
options.



 
 -- 
 Carlos Sousa
 http://vbc.dyndns.org/
 
 
 -- 
 To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
 with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
 
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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 HTTP/1.0 200 20872
 - Dillo/0.7.3 TCP_MISS:DIRECT
 
 but that just removes the test from .wilderness 

That's right, [:alpha:] only gets letters, and [:alnum:] letters and
digits, missing the dots, slashes, etc. This will work:

   sed 's/^[^[:space:]]*[[:space:]]*//'

meaning 'scrap all non-blanks and following blanks, from the start of
the line.

 I thought I would
 be able to use grep and sed to do the job for me and I can use grep to
 filter them in separate log files but I now need to delete that first
 virtual host entry so I can use webalizer to analyse the seperate log
 files. I have read the info page for sed and looked at tutorials and
 the faq but haven't seen been able to really understand the options.

Don't worry, it comes with practice

Cheers,

-- 
Carlos Sousa
http://vbc.dyndns.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



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.
NEWLINE
Package: foo
Pin: bar
NEWLINE
Package: ...

etc ...



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.
 NEWLINE
 Package: foo
 Pin: bar
 NEWLINE
 Package: ...
 
 etc ...
 

Contents of ~/addblank.sed :
--- cut here
/^Package:/ {
i \

}
--- cut here

Note that line 3 of the ~/addblank.sed is blank, but needed.

then 
$ sed -f ~/addblank.sed  somewhere

should do the trick for you..

For futher information:

$ man sed

:-)

-- 
Karl E. Jørgensen
[EMAIL PROTECTED]
www.karl.jorgensen.com
Please study http://www.rfc855.org


pgpG0UMqUrMfb.pgp
Description: PGP signature


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 `$sedcsript`
   do
   $SOME $zone $MANAGENENT
   done
 
 or if there is a better way..
 I get tired of hand editingesp since I can't seem to remember cutpaste
 in vi

well, perl is a resource hog, but that's because it can do just
about anything, in eleven keystrokes... :)

but if you're determined to use smaller components, how about

$zones = `grep ^zone  /etc/bind/named.conf | cut -f2 '-d'`

man cut

of course, you could use 'sed' if you absolutely felt obliged
to... :)

-- 
It is always hazardous to ask Why? in science, but it is often
interesting to do so just the same.
-- Isaac Asimov, 'The Genetic Code'

[EMAIL PROTECTED]
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!



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 better way..
I get tired of hand editingesp since I can't seem to remember cutpaste
in vi



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 removes the %\n sequence (I don't quite
Daniel understand, why sed can't do it with the one-liner you
Daniel mentioned, but I guess there's a good reason).  Regards,
Daniel Daniel

Thanks! That is just what I wanted...

Now - how do I put this into a Makefile?

I found out how to put the command on one line:

sed '/%$/{ N; s/%\n//; }' report.bbl new

which works from zsh, but not make:

sed '/%{ N; s/%\n//; }' report.bbl  report.bbl.new
sed: -e expression #1, char 10: Unknown command: ``%''
make: *** [report.dvi.stamp] Error 1

Oh, I see the problem - the $/ bit has been removed (by make). How do I
get this to work?  No - \$/ just becomes \
-- 
Brian May [EMAIL PROTECTED]



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 understand, why sed can't do it with the one-liner you
mentioned, but I guess there's a good reason).
Regards,
Daniel

 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=http://www.microsoft.com/technet/win2000/win2ksrv/technote/kerberos.asp%
  =.
  
  which is interpreted by LaTeX to display a percent sign at the end of
  the URL :-(




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

...but that doesn't seem to work.  I've tried every possible variant (well,
not every one, otherwise it'd be working for me) and even explored awk's man
page.  Any suggestions (or the POA if you have it :-)

Jesse

POA(plain old answer)
-- 
Got freedom?
http://www.debian.org



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 what I
 got so far:
 
 echo $variable_before | sed s///./ variable_after
 
 ...but that doesn't seem to work.  I've tried every possible variant (well,
 not every one, otherwise it'd be working for me) and even explored awk's man
 page.  Any suggestions (or the POA if you have it :-)

[EMAIL PROTECTED] eb]$ foo=usr/bin
[EMAIL PROTECTED] eb]$ echo $foo
usr/bin
[EMAIL PROTECTED] eb]$ bar=$(echo $foo | sed -e 's/\//./g')
[EMAIL PROTECTED] eb]$ echo $bar
usr.bin
[EMAIL PROTECTED] eb]$

you can also use the same variable ie:

[EMAIL PROTECTED] eb]$ foo=usr/bin
[EMAIL PROTECTED] eb]$ foo=$(echo $foo | sed -e 's/\//./g')
[EMAIL PROTECTED] eb]$ echo $foo
usr.bin
[EMAIL PROTECTED] eb]$

one problem with your sed script, you need to escape the / 

-- 
Ethan Benson
http://www.alaska.net/~erbenson/


pgpEJSoPRWuYA.pgp
Description: PGP signature


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 $variable_before | sed s///./ variable_after


Try:

variable_after=`echo $variable_before | sed   's/\//./' `
(you must escape the /)

If you want to replace all the occurences of / add an 'g' :

variable_after=`echo $variable_before | sed   's/\//./g' `


You can do this also only with bash:

variable_after=${variable_before/\//.} 

and  for multiple occurences:

variable_after=${variable_before//\//.} 


Andrei



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 regular expressions 8-(.  Here's 
  what I
  got so far:
  
  echo $variable_before | sed s///./ variable_after
 
 
 Try:
 
 variable_after=`echo $variable_before | sed   's/\//./' `
 (you must escape the /)


This was exactly what I needed.  Thank you!
 
 If you want to replace all the occurences of / add an 'g' :
 
 variable_after=`echo $variable_before | sed   's/\//./g' `




 
 
 You can do this also only with bash:
 
 variable_after=${variable_before/\//.} 
 
 and  for multiple occurences:
 
 variable_after=${variable_before//\//.} 
 
 
 Andrei
-- 
Got freedom?
http://www.debian.org



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 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=http://www.microsoft.com/technet/win2000/win2ksrv/technote/kerberos.asp%
=.

which is interpreted by LaTeX to display a percent sign at the end of
the URL :-(
-- 
Brian May [EMAIL PROTECTED]



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=http://www.microsoft.com/technet/win2000/win2ksrv/technote/kerberos.asp%
 =.
 
 which is interpreted by LaTeX to display a percent sign at the end of
 the URL :-(

How about:
1. download source
2. fix source
3. send a patch to the maintainer

That way I won't have this problem when I use bibtex for urls in the
future.  ;)

Hmm, I guess that wasn't very helpful.  You might want to try adding a
'%' character to the end of your URL in your .bib file.  This might
survive past bibtex, and will tell LaTeX to ignore the remainder of the
line.  If the remainder of the line is just that extra character, it
might pull off what you're looking for.  Or not.  I haven't tested this.

Damian Menscher
-- 
--==## Grad. student  Sys. Admin. @ U. Illinois at Urbana-Champaign ##==--
--==## [EMAIL PROTECTED] www.uiuc.edu/~menscher/ Ofc:(217)333-0038 ##==--
--==## Physics Dept, 1110 W Green, Urbana IL 61801 Fax:(217)333-9819 ##==--



Re: SED question RESOLVED

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 sure you understand the backquotes too.

-- 
Greg Wooledge| Truth belongs to everybody.
[EMAIL PROTECTED] |   Red Hot Chili Peppers,
http://www.kellnet.com/wooledge/ |


pgp6N3Q9rn0we.pgp
Description: PGP signature


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 florida roam.db | sed -e s/^.*\? //g`

Those are backticks (`), not apostrophes (').

-- 
Eric Gillespie, Jr. * [EMAIL PROTECTED]

Man is a rope, tied between beast and overman--a rope over an abyss.
 A dangerous across, a dangerous on-the-way, a dangerous looking-back,
 a dangerous shuddering and stopping.
 --Friedrich Nietzsche


pgpBa33urAD9L.pgp
Description: PGP signature


Re: SED question RESOLVED

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 | sed -e s/^.*\? //g`
I had to use the back quotes``
thanx
 


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 day long after that. Suddenly it came to me.
Thanks for the reply though.


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 work :

myvar=`grep florida roam.db | sed -e s/^.*\? //g`

  HTH,

  Etienne


Re: SED question RESOLVED

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