0

I have file with these columns and tab separated.

Jun-AP1(bZIP)/K562-cJun-ChIP-Seq(GSE31477)/Homer    12.88%  4926.5  9.08%
Maz(Zf)/HepG2-Maz-ChIP-Seq(GSE31477)/Homer  52.08%  25510.3 47.00%
Bach2(bZIP)/OCILy7-Bach2-ChIP-Seq(GSE44420)/Homer   10.81%  4377    8.06%
Atf3(bZIP)/GBM-ATF3-ChIP-Seq(GSE33912)/Homer    28.73%  13346.9 24.59%
TEAD4(TEA)/Tropoblast-Tead4-ChIP-Seq(GSE37350)/Homer    40.43%  19549.3 36.01%

In first column, I want to extract the string upto first bracket and keep rest of the columns same. For instance, I need the output as shown below.

Jun-AP1 12.88%  4926.5  9.08%
Maz 52.08%  25510.3 47.00%
Bach2   10.81%  4377    8.06%
Atf3    28.73%  13346.9 24.59%
TEAD4   40.43%  19549.3 36.01%

Thank you.

2 Answers 2

1

I would start with

sed 's/([^ ]*//'

where that's an actual tab character in [^ ].

Sign up to request clarification or add additional context in comments.

2 Comments

It works perfect without '(' in your answer. i.e. sed 's/[^ ]*//'
@EdMorton Whoops! Thanks for pointing that out. (Stupid cut and paste error, like a darn newbie.) @NareshDJ Yes, as you discovered, it should have been s/([^ ]*//, without the ​\​.
0
awk '{sub(/\(.*Homer/,"")}{print $1,$2,$3,$4}' file

Jun-AP1 12.88% 4926.5 9.08%
Maz 52.08% 25510.3 47.00%
Bach2 10.81% 4377 8.06%
Atf3 28.73% 13346.9 24.59%
TEAD4 40.43% 19549.3 36.01%

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.