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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing trailing spaces from delimited files djkane Shell Programming and Scripting 6 03-29-2006 03:11 AM
Removing page space srnkumar AIX 4 01-05-2006 01:04 AM
Removing leading and trailing spaces of data between the tags in xml. jhmr7 UNIX for Dummies Questions & Answers 2 05-18-2005 07:27 AM
Removing Space at the end of file rkumar28 Shell Programming and Scripting 4 03-03-2005 05:42 AM
removing trailing spaces of a particular column in a file rooh UNIX for Dummies Questions & Answers 2 01-12-2002 07:34 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-18-2003
oombera's Avatar
Have a day :|
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
re: removing trailing space from lines

Quote:
Originally posted by sameerbo
Hi,

How can we remove the all trailing spaces of a line from a file.


TiA
Sameer.
Not sure why this thread was closed without any explanation, but you can do what you're asking with sed 's/[[:blank:]]*$//g' < sourceFile > destFile
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-19-2003
Registered User
 

Join Date: Jun 2003
Location: Delhi, India
Posts: 3
Thank You! oombera, for answering the query.
I really appreciate your effort to answer, even the closed thread.

I was going through the various threads after posting my query.
there was one thread 'Remove Last Character of Line'. this was pretty similar query. I got the answer for my query from this thread.

And that is why i closed the thread.

I just tried this syntax but it doesn't work. I am working on solaris 5.8. And I am not sure whether this syntax works on other platform. may be this is the case, that, it work on some other platform.

I used this syntax.
---------------------------------------------
sed 's/ *$//g' < file_tailing_spaces
---------------------------------------------
Notice that it has two spaces preceeding '*$'
Actually, I have file which has more than one trailing spaces. It worked.

Thank You! Once Again.
Sameer.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:07 AM.


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

Content Relevant URLs by vBSEO 3.2.0