LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-23-2009, 11:29 AM   #1
tebucky
Member
 
Registered: Mar 2004
Posts: 89

Rep: Reputation: 15
Help with script removing white space from a file


All,

I have a fairly large file where each line looks like this:

/^.*@(.+\.)* test.us $/ test.com

What I want to do is remove all the white space from this portion:

/^.*@(.+\.)* test.us $/

and leave space between the / and test.com

Can anyone help? My shell scripting/sed skills are pretty weak.

Thanks!
 
Old 07-23-2009, 11:38 AM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
can you give us sample texts instead please
 
Old 07-23-2009, 12:04 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,557
Blog Entries: 28

Rep: Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178
Hello tebucky
Quote:
Originally Posted by tebucky View Post
All,

I have a fairly large file where each line looks like this:

/^.*@(.+\.)* test.us $/ test.com

What I want to do is remove all the white space from this portion:

/^.*@(.+\.)* test.us $/

and leave space between the / and test.com

Can anyone help? My shell scripting/sed skills are pretty weak.

Thanks!
If it's a large file then sed or awk would be better choices than shell script; shell script would be relatively slow.

As konsolebox asked, can we have some actual texts? "/^.*@(.+\.)* test.us $/" looks as if you are defining the lines using a regular expression which, all due respect, may not be right if your sed skills are weak like you say -- plus it's better for us to test solutions on data than on meta data.

Best

Charles
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
removing white spaces in the file tucs_123 Linux - Newbie 9 01-03-2009 11:28 AM
Basic Perl - removing white from split field. ryedunn Programming 7 09-13-2006 01:24 AM
problems in removing white spaces from string of text monil Programming 7 03-08-2005 12:28 PM
removing white space accent11 Linux - Software 4 10-06-2004 02:30 AM
removing lines from file script iluvatar Programming 9 08-20-2004 06:49 AM


All times are GMT -5. The time now is 11:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration