Freedom to Write
Tuesday, 6 January 2009
How to remove trailing new line
say, my file name emp.txt contains the following :
sriram
rajesh
khanna
raghu
sekhar
teja
I want to remove the new line after every name and write them in a csv format :
awk '{print $1}' /tmp/my | tr '\n' ',' will give us comma seperated output :
sriram,rajesh,khanna,raghu,sekhar,teja
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Tweets by @sriramperumalla
No comments:
Post a Comment