LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 05: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, 06:08 AM   #2
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: win 10 | OpenBSD 6.1 | Fedora 27
Posts: 252

Rep: Reputation: 78
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 07:46 PM
sed command to replace slash with backslash stelmed Slackware 13 08-19-2010 06:01 AM
Does anyone know of a bash script can search & replace txt in a file. jimwelc Linux - Newbie 6 09-15-2008 01:13 AM
strcpy inside kernel space vishalbutte Programming 1 02-28-2006 07:34 PM
How to replace spaces in filenames with underscores rosslaird Linux - Software 4 02-22-2005 02:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:37 PM.

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