LinuxQuestions.org
Visit Jeremy's Blog.
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 05-24-2006, 04:30 AM   #1
repolona
LQ Newbie
 
Registered: Nov 2004
Posts: 12

Rep: Reputation: 0
Cool How do i change spaces inside a txt file, and replace space with backslash \?


How do i change all space inside a txt file, and replace it with backslash \ character, using SED (stream editor)?

i have a file which looks like this:

T67115_MARKETS-JAPAN-STOCKS (UPDATE 7)_0524_08.TXT
^spaces ^spaces

T67115_MARKETS-JAPAN-STOCKS\(UPDATE\7)_0524_08.TXT
^bckslh ^bckslh

HKG309025_FINANCIAL-CHINA-BOC (UPDATE 3)_0524_08.TXT
SYD164457_MARKETS-AUSTRALIA-STOCKS (UPDATE 4)_0524_08.TXT
T25436_JAPAN-BUSINESS-LOBBY_0524_08.TXT
USN003672_ECONOMY-IMF (URGENT)_0524_08.TXT
L24323231_ECONOMY-OECD-JOHNSTON (UPDATE 1)_0524_08.TXT
SP141903_MARKETS-GLOBAL (WRAPUP 2)_0524_08.TXT
T264998_ECONOMY-JAPAN-IMF (UPDATE 1)_0524_08.TXT
SP155794_MARKETS-PRECIOUS (UPDATE 2)_0524_08.TXT
T74967_MARKETS-JAPAN-JGB (UPDATE 2)_0524_08.TXT
KLR167364_UTILITIES-MALAYSIA-TARIFF (UPDATE 1)_0524_08.TXT
KLT003776_UTILITIES-MALAYSIA-TARIFF (URGENT)_0524_08.TXT
DHA156987_ECONOMY-BANGLADESH-TAX_0524_08.TXT
SYD140333_FINANCIAL-AUSTRALIA-SFE-ASX (UPDATE 1)_0524_08.TXT
AAT006393_RETAIL-AHOLD-SALES (URGENT)_0524_08.TXT
T80152_MARKETS-JAPAN-STOCKS (UPDATE 6)_0524_08.TXT
KLR308342_MARKETS-ASIA-WORLDCUP (PICTURE)_0524_08.TXT

thanks
 
Old 05-24-2006, 05:08 AM   #2
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: win 10 | OpenBSD 6.1
Posts: 225

Rep: Reputation: 59
sed -e 's/ /\\/g'
 
  


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
Help Strip / Remove attachments (Replace with TXT file if Possible) Vince0000 Linux - General 2 09-17-2010 06:46 PM
sed command to replace slash with backslash stelmed Slackware 13 08-19-2010 05:01 AM
Does anyone know of a bash script can search & replace txt in a file. jimwelc Linux - Newbie 6 09-15-2008 12:13 AM
strcpy inside kernel space vishalbutte Programming 1 02-28-2006 06:34 PM
How to replace spaces in filenames with underscores rosslaird Linux - Software 4 02-22-2005 01:08 AM


All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration