Skip to main content
added 17 characters in body; edited title
Source Link

Text selection in unixUnix using sed

I want to select a particular part of a text file and print it  / store on store in another file.

selectionSelection starts when a particular pattern matches and ends when another pattern matches. and i'veAnd I have to do it without awk.. i'm  I'm trying using sed.

  • start selection when found expected
  • up to when found actual

start selection when found expected upto when found actual</>

|e|build_event_details_json(e) }) expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",actual collection contained: [{"id"=>18646

> |e|build_event_details_json(e) })
       expected collection contained:  [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",actual collection contained:    [{"id"=>18646

answer should be

expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",

>  expected collection contained:  [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",

Text selection in unix using sed

I want to select a particular part of a text file and print it/ store on another file.

selection starts when a particular pattern matches and ends when another pattern matches. and i've to do it without awk.. i'm trying using sed.

start selection when found expected upto when found actual

|e|build_event_details_json(e) }) expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",actual collection contained: [{"id"=>18646

answer should be

expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",

Text selection in Unix using sed

I want to select a particular part of a text file and print it  / store in another file.

Selection starts when a particular pattern matches and ends when another pattern matches. And I have to do it without awk.  I'm trying using sed.

  • start selection when found expected
  • up to when found actual

</>

> |e|build_event_details_json(e) })
       expected collection contained:  [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",actual collection contained:    [{"id"=>18646

answer should be

>  expected collection contained:  [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",
Source Link
Sandy
  • 23
  • 4

Text selection in unix using sed

I want to select a particular part of a text file and print it/ store on another file.

selection starts when a particular pattern matches and ends when another pattern matches. and i've to do it without awk.. i'm trying using sed.

start selection when found expected upto when found actual

|e|build_event_details_json(e) }) expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",actual collection contained: [{"id"=>18646

answer should be

expected collection contained: [{"id"=>18646, "state"=>"available", "salesEndAtUtc"=>"2018-09-22T00:00:00.000Z",