fork download
  1. #!/bin/bash
  2. text='Some 11 number and 11| that we need
  3. Redundant line'
  4. s="11
  5. 12
  6. 31
  7. 40
  8. 42
  9. 90"
  10. grep -E -f <(sed -E '/^[0-9]+$/!d;s/.*/&\\|/' <<< "$s") <<< "$text"
  11. grep -oE -f <(sed -E '/^[0-9]+$/!d;s/.*/&\\|/' <<< "$s") <<< "$text"
  12.  
Success #stdin #stdout 0.01s 5524KB
stdin
Standard input is empty
stdout
Some 11 number and 11| that we need
11|