Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

awk for separating word by underscores

I am really terrible at using awk, but I know it's pretty useful for strain operations.

I have a file of the form:

JohnSmith_name    3.4     
KellySears_name   5.7
RonaldBay_name    1.2     
RayShendor_name   2.8

I want to read the file and basically strip the _name tag from the real name and print the line. How can I do that using awk??

Thanks!

like image 310
Sakti Avatar asked Apr 18 '26 15:04

Sakti


1 Answers

You can use sed more easily than awk in this case, I think:

$ sed s/_name// file
JohnSmith    3.4     
KellySears   5.7
RonaldBay    1.2     
RayShendor   2.8
like image 57
Carl Norum Avatar answered Apr 21 '26 09:04

Carl Norum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!