The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 06:48 AM
Remove Data from Fields greengrass UNIX for Dummies Questions & Answers 4 01-15-2007 05:41 PM
How can i remove spaces in between the fields in a file dsravan Shell Programming and Scripting 3 09-26-2006 04:11 PM
help me to remove the whitespaces between the lines ...urgent kumar1 Shell Programming and Scripting 5 10-10-2005 08:51 AM
Splitting comma separated values into an array tmarikle Shell Programming and Scripting 3 06-24-2005 05:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-13-2008
nitinbjoshi nitinbjoshi is offline
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
  #2 (permalink)  
Old 06-13-2008
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

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

Code:
awk '{$1=$1;OFS=""}1' infile > outfile
  #3 (permalink)  
Old 06-14-2008
nitinbjoshi nitinbjoshi is offline
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0