fork(3) download
  1. #!/bin/bash
  2. x="Mobile:25:15000#TV:10:20000#Laptop:20:65000"
  3. y="Laptop"
  4. o_str=$(awk -v y="$y" -F: 'BEGIN{RS="#"} $1 == y' <<< "$x");
  5. echo "$o_str"
Success #stdin #stdout 0.01s 5408KB
stdin
Standard input is empty
stdout
Laptop:20:65000