Skip to main content
Post Made Community Wiki by don_crissti
deleted 4 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".


With gnu sed:

sed -u -n -e 'p;w /dev/stderr' -e 's|.*|date|e'*||e' edscript | ed

Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in x*; do awk '{ print >"/dev/stderr"; print }' $i; done | ed

or

for i in x*; do sed -n -e 'p;w /dev/stderr' $i; done | ed

to get the expected result. Then you rm x*...

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".


With gnu sed:

sed -u -n -e 'p;w /dev/stderr' -e 's|.*|date|e' edscript | ed

Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in x*; do awk '{ print >"/dev/stderr"; print }' $i; done | ed

or

for i in x*; do sed -n -e 'p;w /dev/stderr' $i; done | ed

to get the expected result. Then you rm x*...

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".


With gnu sed:

sed -u -n -e 'p;w /dev/stderr' -e 's|.*||e' edscript | ed

Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in x*; do awk '{ print >"/dev/stderr"; print }' $i; done | ed

or

for i in x*; do sed -n -e 'p;w /dev/stderr' $i; done | ed

to get the expected result. Then you rm x*...

deleted 182 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".
The system("sleep 0") is there just to break the stream input to pipe. You could equally use something else as long as it doesn't produce any output and comes from a different source, e.g. system("date >/dev/null") or


With system("echo BREAKgnu >/dev/null")sed.:

sed -u -n -e 'p;w /dev/stderr' -e 's|.*|date|e' edscript | ed

Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in x*; do cat $iawk |'{ teeprint >"/dev/tty;stderr"; sleepprint 0;}' $i; done | ed

and get the expected result:or

a
hello
world
.
,n
1for i in hello
2x*; do sed world
,s,o,O,g
,-n
1 -e 'p;w hellO
2/dev/stderr' $i; done wOrld
Q| ed

to get the expected result. Then you rm x*...

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".
The system("sleep 0") is there just to break the stream input to pipe. You could equally use something else as long as it doesn't produce any output and comes from a different source, e.g. system("date >/dev/null") or system("echo BREAK >/dev/null").


Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i x*; do cat $i | tee /dev/tty; sleep 0; done | ed

and get the expected result:

a
hello
world
.
,n
1   hello
2   world
,s,o,O,g
,n
1   hellO
2   wOrld
Q

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".


With gnu sed:

sed -u -n -e 'p;w /dev/stderr' -e 's|.*|date|e' edscript | ed

Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in x*; do awk '{ print >"/dev/stderr"; print }' $i; done | ed

or

for i in x*; do sed -n -e 'p;w /dev/stderr' $i; done | ed

to get the expected result. Then you rm x*...

deleted 373 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".
The system("sleep 0") is there just to break the stream input to pipe. You could equally use something else as long as it doesn't produce any output and comes from a different source, e.g. system("date >/dev/null") or system("echo BREAK >/dev/null").


Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in a{a..h};x*; do cat x$i$i | tee /dev/tty; sleep 0; done | ed

and get the expected result:

a
hello
world
.
,n
1   hello
2   world
,s,o,O,g
,n
1   hellO
2   wOrld
Q

The downside is that each time the number of lines in your script changes you'll have to adjust the second command, i.e. if you have pieces starting from xaa up to xbg you would have to run:

for i in a{a..z}} b{a..g};; do cat x$i | tee /dev/tty; done | ed

It'd be easier with gnu split, using the -d (--numeric-suffixes) switch (though not portable).

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".
The system("sleep 0") is there just to break the stream input to pipe. You could equally use something else as long as it doesn't produce any output and comes from a different source, e.g. system("date >/dev/null") or system("echo BREAK >/dev/null").


Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i in a{a..h}; do cat x$i | tee /dev/tty; done | ed

and get the expected result:

a
hello
world
.
,n
1   hello
2   world
,s,o,O,g
,n
1   hellO
2   wOrld
Q

The downside is that each time the number of lines in your script changes you'll have to adjust the second command, i.e. if you have pieces starting from xaa up to xbg you would have to run:

for i in a{a..z}} b{a..g};; do cat x$i | tee /dev/tty; done | ed

It'd be easier with gnu split, using the -d (--numeric-suffixes) switch (though not portable).

Well, after monkeying around with it, this is what I'd use:

 awk '{ print; system("sleep 0") }' edscript | tee /dev/tty | ed

or, without tee:

awk '{ print >"/dev/stderr"; print | "ed"; system("sleep 0") }' edscript

If print >"/dev/stderr" doesn't work on your system you could use print | "cat >&2".
The system("sleep 0") is there just to break the stream input to pipe. You could equally use something else as long as it doesn't produce any output and comes from a different source, e.g. system("date >/dev/null") or system("echo BREAK >/dev/null").


Another way that works just as well:
Use split to split your edscript on each line:

split -l1 edscript

this will produce pieces like xaa, xab...xah.
You could then use the pieces like this:

for i x*; do cat $i | tee /dev/tty; sleep 0; done | ed

and get the expected result:

a
hello
world
.
,n
1   hello
2   world
,s,o,O,g
,n
1   hellO
2   wOrld
Q
added 1 character in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
deleted 1300 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
added 15 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
added 16 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
deleted 15 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
added 278 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
deleted 1 character in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
added 167 characters in body
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262
Loading