The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Advise on HP unix liema UNIX for Dummies Questions & Answers 5 10-20-2009 06:38 AM
I am one of the newbies, please advise sanlen UNIX for Dummies Questions & Answers 3 09-17-2007 08:45 AM
Need your advise for which version ? terryfox UNIX for Dummies Questions & Answers 3 05-23-2006 12:00 AM
2 cases !!! plz advise mduweik SUN Solaris 9 02-13-2006 05:02 AM

Reply
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-11-2009
Haque123 Haque123 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 45
SED Issue please advise!!!

Hi folks,

Please share your ideas I want to conventor all the blank space's in my file to a single blank,

Im using this currently sed 's/ / /' foo for two blank space but the blanks in the file varies like for example 2 blanks, 3 blanks, 4 blanks etc etc....


please help what should I use here to convert into single blank in a file..


Quick response will be appreciated!!!

Haque
  #2 (permalink)  
Old 06-11-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,941
Assuming blank space also includes tabs then the following should work for you

Code:
sed 's/[[:blank:]][[:blank:]]*/ /g' file

  #3 (permalink)  
Old 06-11-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,345
With awk:


Code:
awk '{$1=$1}1' file

Reply

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 08:07 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