User User name Password  
   
Thursday 28.8.2008 / 04:02 AM
Search:        In English   Suomeksi   På svenska
afterdawn.com / profiles / agent_007 / blog archive / sed: how to delete both leading and trailing whitespace from each line /
Home Blog Pictures Shoutbox Links

sed: how to delete BOTH leading and trailing whitespace from each line

30 Jun 2008 5:10 (Edited: 30 Jun 2008 5:10)

Some environments or programs don't like whitespace. If you have Linux/Unix environment, you can use sed to remove BOTH leading and trailing whitespace from each line of the file.

sed -e 's/^[ \t]*//;s/[ \t]*$//' input_file > output_file

just replace input_file and output_file with the filenames you use.

DON'T try to use same input_file and output_file filename!

Tags: leading  remove  sed  trailing  whitespace 

 

List of my blog entries

User comments

    (No comments made)


Post your comment

In order to post your comments here, you need be logged in to our system. Simply follow this link in order to login and to post your comments here.

Digital video: AfterDawn.com | AfterDawn Forums | DVD X Copy Forums
Music: MP3Lizard.com
Gaming: Blasteroids.com | Blasteroids Forums
Software: Software downloads
Blogs: User profile pages
RSS feeds: AfterDawn.com News | Software updates | AfterDawn Forums
International: AfterDawn in Finnish | AfterDawn in Swedish | download.fi | fin.MP3Lizard.com
Navigate: Search | Site map
About us: About AfterDawn Ltd | Advertise on our sites | Rules, Restrictions, Legal disclaimer & Privacy policy
Contact us: Send feedback | Contact our media sales team
 
  © 1999-2008 by AfterDawn Ltd.