fork(6) download
  1. #!/bin/bash
  2. s='UA399_GTTTCG_L002_R1_001.file.gz'
  3. awk -F'_' '{print $1"_"$2"_"$3}' <<< "$s"
  4. sed 's/^\([^_]*\(_[^_]*\)\{2\}\).*/\1/' <<< "$s"
  5. cut -d_ -f1,2,3 <<< "$s"
Success #stdin #stdout 0s 23336KB
stdin
Standard input is empty
stdout
UA399_GTTTCG_L002
UA399_GTTTCG_L002
UA399_GTTTCG_L002