Announcement

Collapse
No announcement yet.

SED help delete characters

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SED help delete characters

    Hi Please help me to refine my syntax. I want to delete the excess characters from the out put below.

    -bash-3.00$ top -b -n2 -d 00.20 |grep Cpu|tail -1 | awk -F ":" '{ print $2 }' | cut -d, -f1
    4.4% us

    now i want to delete the % and us. How wil i do that to make it just 4.4.

    Thanks

  • #2
    If you have data with "4.4% us" and you want to remove "% us":
    Code:
     
    echo "4.4% us" | sed "s/% us//"

    Comment

    Working...
    X