Re: Removing Backslash with Sed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Charles Curley wrote:
> On Thu, Sep 07, 2006 at 03:43:14PM -0400, R. G. Newbury wrote:
>> I have large number of scanned images of documents, which have been 
>> 'managed' by a windows program which produces an index page with a link 
>> to each document, and a document page with links to each page in the 
>> document. There are about 1400 document pages.
>> Unfortunately the windows program produces a link in the form:
>> <a href='..\index.html'><img src='..\header_index.jpg'>
>> That is: containing backslashes.
>>
>> I have tried to figure our a search/replace line for sed but nothing I 
>> have tried works...in part I assume because the '\' is itself the 
>> 'escape' character. Even so, search expressions like '..\\' do not work.
>>
>> ANyone know how to do this? There are about 20 backslashes in each 
>> document index page, so I am not even considering a manual method... 
>> although that works...
> 
> Try this untested line on a throw-away file:
> 
> sed -i s/\\/\//g filename
> 
> 
I like this form better - you do not have to use / to separate
fileds, and I find using @ is more readable in cases like this. I
also find that enclosing the regular expression in quotes works better.

sed -i -e 's@\\@/@g' filename

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux