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
remove spaces btw tjmannonline UNIX for Dummies Questions & Answers 7 05-26-2008 03:35 AM
removing extra spaces agarwal Shell Programming and Scripting 2 04-25-2008 05:54 AM
How to remove trailing spaces mahek_bedi UNIX for Dummies Questions & Answers 2 08-10-2007 08:21 AM
To remove Continous blank spaces from a file in UNIX arunkumar_mca UNIX for Dummies Questions & Answers 1 12-08-2006 01:10 AM
remove extra lines in the file CamTu Shell Programming and Scripting 8 03-29-2005 02:13 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 05-04-2006
Sho Sho is offline
Registered User
  
 

Join Date: May 2006
Posts: 3
Smile To remove the extra spaces in unix

Hi...
I am quite new to Unix and would like an issue to be resolved.

I have a file in the format below;
4,Reclaim,ECXTEST02,abc123,Harry Potter,5432 6730 0327 5469,0603,,MC,,1200,EUR,sho-001,,1,,,abc123,1223

I would like my output to be as follows;

4,Reclaim,ECXTEST02,abc123,Harry Potter,5432673003275469, 0603,,MC,,1200,EUR,sho-001,,1,,,abc123,1223

i.e i want the inbetween spaces from the 6th field to be removed.
Please do help

Thanks in advance
  #2 (permalink)  
Old 05-04-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Code:
nawk -F, -v OFS=, '{ gsub(/ /,//, $6); print }'
  #3 (permalink)  
Old 05-04-2006
Sho Sho is offline
Registered User
  
 

Join Date: May 2006
Posts: 3
Thanks a lot.
But when I tried using the above nawk command, I got the followin error;
"nawk: empty regular expression
source line number 1
context is
{ gsub(/ >>> /,// <<< , $6); print }"

Not sure on what I m missing out.

Please do help me out. Thanks...
  #4 (permalink)  
Old 05-04-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by vino
Code:
nawk -F, -v OFS=, '{ gsub(/ /,//, $6); print }'
Try

Code:
nawk -F, -v OFS=, '{ gsub(" ","", $6); print }'
  #5 (permalink)  
Old 05-04-2006
Sho Sho is offline
Registered User
  
 

Join Date: May 2006
Posts: 3
Thats gr8888! A Million thanks to you...
Itz working perfect...
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 02:11 PM.


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