fork download
  1. #!/bin/bash
  2. # your code goes here
  3.  
  4. cd /tmp
  5. echo 'aaaa' > 1.txt
  6. echo 'bgdgsgbsb' >> 1.txt
  7. echo 'cccc' >> 1.txt
  8. echo 'dddd' >> 1.txt
  9.  
  10. sed '
  11. /b.*b/ {h;d}
  12. $ {p;g}
  13. ' 1.txt
Success #stdin #stdout 0s 19624KB
stdin
Standard input is empty
stdout
aaaa
cccc
dddd
bgdgsgbsb