Remove line starting from space till end.

Hi,

I have a code tag, from which i have the below snippet:

intelrpt.GetCMB_FB type=ODBC>
intelrpt.GetCMB_FB type=SYBASE>

I want the output like:

intelrpt.GetCMB_FB
intelrpt.GetCMB_FB

That is remove the lines starting from WHITESPACE till end.
Please help. I am new to sed.

sed 's/ .*//' input_file
awk '{print $1}' "$file"

Thanks for your help, it really works.

Can you please help with the below output:

imrpt.GetCMB_FB,imrpt.GetCMB_FB,

"," at end of each line.

sed 's/,$//' input_file

Sorry i am getting same output:

intelrpt.GetCMB_FB type=ODBC>
intelrpt.GetCMB_FB type=SYBASE>

Thanks in advance.

awk '{printf $1","}' file 
1 Like
 $ ruby -ane 'print $F[0]+",\n"' file