extracting the column using AWK

I am trying to extract column using AWK. Source file is a .CSV file and below is command I am using:

 awk -F ',' '{print $1}' abc.csv > test1

Data in file abc.csv is like below:

xyz@yahoo.com,160,1,2,3
abc@ymail.com,1,2,3,160

But data obtained in test1 is like :

abc@ymail.comxyz@ymail.com

when file is opened in notepad after downloading the file from server.

Answers


Notepad doesn't show newlines created on unix. If you want to add them, try

awk -F ',' '{print $1"\r"}' abc.csv > test1

Since you're using a Window tool to read the output you just need to tell awk to use Windows line-endings as the Output Record Separator:

awk -v ORS='\r\n' -F',' '{print $1}' file

Need Your Help

jQuery Toggle Div Switcher

jquery html toggle switch-statement fade

I'm trying to build an FAQ page. The page will have 2 columns: first column will have list of questions, second column will have the answers.

wpf 3D animation

c# wpf animation 3d xna

Can I use WPF to import a 3D character and manually animate it like the skinned model