fork(3) download
  1. #!/bin/bash
  2. input_str='abc_123_def_20181217T2345'
  3. echo $input_str | sed 's/\(.*\)_\([0-9]\{8\}\).*/\1/'
  4. # abc_123_def
  5. #Case 2:
  6. input_str='abc_123_def_20181217T2345_20181218T2345'
  7. sed 's/_[0-9]\{8\}.*//' <<< "$input_str"
  8. #abc_123_def_20181217T2345
Success #stdin #stdout 0s 19632KB
stdin
Standard input is empty
stdout
abc_123_def
abc_123_def