The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Validation of character separated lines in a file kolesunil UNIX for Dummies Questions & Answers 3 05-27-2008 03:48 AM
Remove Data from Fields greengrass UNIX for Dummies Questions & Answers 4 01-15-2007 02:41 PM
How can i remove spaces in between the fields in a file dsravan Shell Programming and Scripting 3 09-26-2006 01:11 PM
help me to remove the whitespaces between the lines ...urgent kumar1 Shell Programming and Scripting 5 10-10-2005 05:51 AM
Splitting comma separated values into an array tmarikle Shell Programming and Scripting 3 06-24-2005 02:50 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-13-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
Remove whitespaces between comma separated fields from file

Hello all,

I am a unix dummy. I am trying to remove spaces between fields. I have the file in the following format


12332432, 2345 , asdfsdf ,100216 , 9999999
12332431, 2341 , asdfsd2 ,100213 , 9999999

& would like to make it

12332432,2345,asdfsdf,100216,9999999
12332431,2341,asdfsd2,100213,9999999

I would appreciate it greatly if there is a command to do this.

Thanks
Nitin
Reply With Quote
Forum Sponsor
  #2  
Old 06-13-2008
rubin's Avatar
Registered User
 

Join Date: Nov 2007
Posts: 216
Code:
sed 's/ //g' infile > outfile
or

Code:
awk '{$1=$1;OFS=""}1' infile > outfile
Reply With Quote
  #3  
Old 06-14-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
Smile Thanks Rubin

The sed command did not give me what I was looking for but the awk worked great

Thanks a million
NJ
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0