sed - Copy multiple hits in one line -
i have file single line this: class="foo" irrelevant stuff (+string) irrelevant stuff class="foo" irrelevant stuff (+string) irrelevant stuff...
need collect every string inside (), there 200 in line.
i can think of adding new line after each class , running egrep.
i use sed 's/class="foo"/\n/g' create new lines after each class. use egrep '(+.*)' filter out strings need , sed again kill () , +.
then here second shot: file, contains 1 line, long one. inside line multiple classes
class="foo" after each class there somewhere
(+bar) between these patters random digits letters ans symbols , repeats 200 times. inside of (+.*) different each repetition.
i need eliminate inside file string contained in (+), , creat newline after each string.
so output this
bar1 bar2 ... barn right im doing so:
sed 's/class="foo"/\n/g' so line each class.
egrep '\(+.*\)' -o to find string inside (+), after 2 times sed kill ( , ).
it want, want know if there better way this.
Comments
Post a Comment