The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 blank lines in *.srt file :) hungbp UNIX for Dummies Questions & Answers 10 02-16-2008 08:40 AM
Removing blank spaces from a file? dfs Shell Programming and Scripting 4 05-22-2007 05:59 PM
To remove the extra spaces in unix Sho UNIX for Dummies Questions & Answers 4 05-04-2006 05:58 AM
remove blank spaces in a string spandu Shell Programming and Scripting 2 03-02-2006 02:08 AM
finding & replacing blank rows/spaces in a file Gerry405 SUN Solaris 2 07-21-2005 04:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2006
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 255
To remove Continous blank spaces from a file in UNIX

All...

I want to remove blank spaces in file . I just leraned that we can use

" cat <Input filename> | tr –s ‘ ‘ > <Target file name> "

i also know with SED we can replace a blank space by other character by

sed s/ /*/g filename.

Please let me know how can i do that by removing the space in sed

1) by modiying the new file . i mean that remove spaces in the file and store it
2) remove spaces in the file and store it in other file

Thanks in advance,
Arun.
  #2 (permalink)  
Old 12-08-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by arunkumar_mca
1) by modiying the new file . i mean that remove spaces in the file and store it
There is no one liner as such unless you use perl. If you have the -i flag for sed, then use

Code:
sed -i -e "s/[ <tab>]*//g" in.txt
Quote:
Originally Posted by arunkumar_mca
2) remove spaces in the file and store it in other file
Code:
sed -e "s/[ <tab>]*//g" in.txt > out.txt
Sponsored Links
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 05:20 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