How to delete expression in the brackets?

how to delete second part in the expression sshd[19557] using gsub function so that output look likes sshd.

Thanks.

Hi tkmmelvin,

Try with:

gsub(/\[.*\]/,"")

So similar what is in:

156815-cut-column-edit-data.html

Regards


$ echo "sshd[19557]" | ruby -e 'puts gets.split("[",2)[0]'
sshd

That's not using the gsub function!

echo "sshd[19557]" | awk -F"[" '{print $1}'
sshd