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
removing spaces sahithi_khushi Shell Programming and Scripting 2 11-03-2006 11:20 AM
Removing spaces at particular position superprogrammer Shell Programming and Scripting 7 07-10-2006 06:29 AM
To remove the extra spaces in unix Sho UNIX for Dummies Questions & Answers 4 05-04-2006 06:58 AM
removing spaces in a file tioray Shell Programming and Scripting 3 11-19-2001 05:44 PM
removing linux/extra partition?? justchillin UNIX for Dummies Questions & Answers 1 08-24-2001 10:53 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 04-25-2008
agarwal agarwal is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 24
removing extra spaces

I have a variable col_head which contains the string " Date Time User Module Description Table Description Key Mode"

I want to remove extra spaces. I am using tr -s command. I am using in the way:
tr -s col_head , but it is giving error.

What is the correct way of using it?
  #2 (permalink)  
Old 04-25-2008
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,428
Code:
col_head=$(echo "$col_head" | tr -s ' ')
Jean-Pierre.
  #3 (permalink)  
Old 04-25-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,322
Wich extra spaces? If you mean the leading space:

Code:
col_head=$(echo "$col_head" | sed 's/^ //')
Regards
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 09:00 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