Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-09-03 Thread David Wright
On Tue 03 Sep 2019 at 09:49:45 (-0400), Greg Wooledge wrote: > On Sat, Aug 31, 2019 at 06:49:38PM -0500, David Wright wrote: > > Exactly; so > > cat afile | some-filter … > > is just the degenerate of the general case > > cat somefiles* | some-filter … > > where there happens to be only one

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-09-03 Thread Greg Wooledge
On Sat, Aug 31, 2019 at 06:49:38PM -0500, David Wright wrote: > Exactly; so > cat afile | some-filter … > is just the degenerate of the general case > cat somefiles* | some-filter … > where there happens to be only one filename matching somefiles*. > So if you start prototyping some complic

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread David
On Sun, 1 Sep 2019 at 00:39, The Wanderer wrote: > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > >> On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: > >> > >>> The only time you need to change the syntax is to add something >

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread David Wright
On Sat 31 Aug 2019 at 11:19:38 (-0400), Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 10:02:43AM -0500, David Wright wrote: > > On Sat 31 Aug 2019 at 10:07:01 (-0400), Roberto C. Sánchez wrote: > > > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > > > > > > > It also loses an

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread David Wright
On Sat 31 Aug 2019 at 11:31:34 (-0400), Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 10:26:34AM -0500, David Wright wrote: > > On Sat 31 Aug 2019 at 11:11:43 (-0400), Roberto C. Sánchez wrote: > > > On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote: > > > > On 2019-08-31 at 10:07,

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread The Wanderer
On 2019-08-31 at 11:56, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 11:38:59AM -0400, The Wanderer wrote: >> Just because I only type the command once doesn't mean that I want >> to type a more complex command than I need to. > > Whereas I'd rather front-load the complexity for the repea

Re: Delete all after a pattern

2019-08-31 Thread The Wanderer
On 2019-08-31 at 12:02, Jonas Smedegaard wrote: > Quoting The Wanderer (2019-08-31 14:39:56) > >> In practice, I'd either use this with 'sed -i [the above >> expression] filename' or (more likely) with 'cat filename | sed >> [the above expression] > newfilename'. > > While wandering(!) off of th

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread tomas
On Sat, Aug 31, 2019 at 11:56:48AM -0400, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 11:38:59AM -0400, The Wanderer wrote: [...] > > I don't suppose you know of any shells which have that behavior, even as > > an option? > > > I am not aware of such a shell, though I have a vague recoll

Re: Delete all after a pattern

2019-08-31 Thread Michael Howard
On 31/08/2019 17:02, Jonas Smedegaard wrote: Quoting The Wanderer (2019-08-31 14:39:56) In practice, I'd either use this with 'sed -i [the above expression] filename' or (more likely) with 'cat filename | sed [the above expression] > newfilename'. While wandering(!) off of the original topic, t

Re: Delete all after a pattern

2019-08-31 Thread Jonas Smedegaard
Quoting The Wanderer (2019-08-31 14:39:56) > In practice, I'd either use this with 'sed -i [the above expression] > filename' or (more likely) with 'cat filename | sed [the above > expression] > newfilename'. While wandering(!) off of the original topic, there is also this: cat filename | sed [

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 11:38:59AM -0400, The Wanderer wrote: > > I don't think I'd prefer it, because it would mean I'd have to remember > where I left the cursor last time rather than being able to just assume > it will always be in a particular position, but I can see that being > just a result

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread The Wanderer
On 2019-08-31 at 11:38, The Wanderer wrote: > On 2019-08-31 at 11:11, Roberto C. Sánchez wrote: >> Don't misunderstand me. I sometimes start interactive command >> lines with 'cat' followed by a pipe. When I do that it is out of >> convenience more than anything else. However, if I am writing

SOLVED !! Re: Delete all after a pattern

2019-08-31 Thread Computer Planet
Thanks Roberto and Wanderer: $ sed 's/config=.*$/config=/g' file.txt was the solution...!! > On 2019-08-31 at 07:58, Roberto C. Sánchez wrote: > > > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > > > >> Hi guys! Is It possible, with "sed" erase all after a pattern? I'm > >> t

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread The Wanderer
On 2019-08-31 at 11:11, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote: > >> On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: >> >> I actually think this is good behavior. The only obvious places to >> put the cursor when doing command history are at th

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 10:26:34AM -0500, David Wright wrote: > On Sat 31 Aug 2019 at 11:11:43 (-0400), Roberto C. Sánchez wrote: > > On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote: > > > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > > > > > > I actually think this is good beha

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread David Wright
On Sat 31 Aug 2019 at 11:11:43 (-0400), Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote: > > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > > > > I actually think this is good behavior. The only obvious places to put > > the cursor when doing command h

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 10:02:43AM -0500, David Wright wrote: > On Sat 31 Aug 2019 at 10:07:01 (-0400), Roberto C. Sánchez wrote: > > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > > > > > It also loses an important benefit when building and tweaking such > > > pipelines by hand:

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 10:39:00AM -0400, The Wanderer wrote: > On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > > I actually think this is good behavior. The only obvious places to put > the cursor when doing command history are at the beginning of the line > and at the end, and for convenienc

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread David Wright
On Sat 31 Aug 2019 at 10:07:01 (-0400), Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > > On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: > > > > > The only time you need to change the syntax is to add something > > > before sed. But then, that's why

Re: Delete all after a pattern

2019-08-31 Thread David Wright
On Sat 31 Aug 2019 at 09:02:07 (-0400), Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 08:39:56AM -0400, The Wanderer wrote: > > On 2019-08-31 at 07:58, Roberto C. Sánchez wrote: > > > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > > > > > >> Hi guys! Is It possible, with

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread The Wanderer
On 2019-08-31 at 10:07, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > >> On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: >> >>> The only time you need to change the syntax is to add something >>> before sed. But then, that's why shells have I/O r

Re: cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 09:26:49AM -0400, The Wanderer wrote: > On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: > > > The only time you need to change the syntax is to add something > > before sed. But then, that's why shells have I/O redirection: > > > > (sed 's/config=.*$/config=/g' | tr -d

Re: Delete all after a pattern

2019-08-31 Thread tomas
On Sat, Aug 31, 2019 at 02:17:30PM +0200, Computer Planet wrote: > Yes, something like this > $ sed -E 's/(.*config=).*/\1/' > but something I had already tried but not work... Well, for me it works: echo "some text before config=mumble mumble" | sed -e 's/\(^.*config=\).*/\1/' => some t

cat and pipelines, mostly (was Re: Delete all after a pattern)

2019-08-31 Thread The Wanderer
On 2019-08-31 at 09:02, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 08:39:56AM -0400, The Wanderer wrote: >> Or perhaps >> >> sed 's/config=.*$/config=/g' >> >> ? >> >> Less elegant and idiomatic, but could also get the job done. >> > OK. > >> The 'g' at the end is in case there can

Re: Delete all after a pattern

2019-08-31 Thread Curt
On 2019-08-31, The Wanderer wrote: > > (And may I say that it's annoying to need to explain this every time, in > order to forestall being called out for "senseless use of cat"? Not that > I get called out for that here very much, but it does seem to happen > virtually every time I don't include a

Re: Delete all after a pattern

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 08:39:56AM -0400, The Wanderer wrote: > On 2019-08-31 at 07:58, Roberto C. Sánchez wrote: > > > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > > > >> Hi guys! Is It possible, with "sed" erase all after a pattern? I'm > >> trying in all way but I can't..

Re: Delete all after a pattern

2019-08-31 Thread The Wanderer
On 2019-08-31 at 07:58, Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > >> Hi guys! Is It possible, with "sed" erase all after a pattern? I'm >> trying in all way but I can't... I'd like to erase all after the >> pattern "config=" but only in the sam

Re: Delete all after a pattern

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 02:17:30PM +0200, Computer Planet wrote: > Yes, something like this > $ sed -E 's/(.*config=).*/\1/' > but something I had already tried but not work... > > On Saturday, 31-08-2019 at 13:58 Roberto C. Sánchez wrote: > > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Pla

Re: Delete all after a pattern

2019-08-31 Thread Computer Planet
Yes, something like this $ sed -E 's/(.*config=).*/\1/' but something I had already tried but not work... On Saturday, 31-08-2019 at 13:58 Roberto C. Sánchez wrote: > On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > > Hi guys! > > Is It possible, with "sed" erase all after a patt

Re: Delete all after a pattern

2019-08-31 Thread Roberto C . Sánchez
On Sat, Aug 31, 2019 at 01:49:20PM +0200, Computer Planet wrote: > Hi guys! > Is It possible, with "sed" erase all after a pattern? > I'm trying in all way but I can't... > I'd like to erase all after the pattern "config=" but only in the same line, > regardless of where it is located inside in a f