Solved

sed - replace backslash linefeed with backslash

Posted on 2011-02-11
6
887 Views
Last Modified: 2012-05-11
sed 's/\\\n/\\/g' doesn't work. What should it be?
0
Comment
Question by:modsiw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 34873420
what do you get when you run command?

try

sed 's/\\n/\/g'
0
 
LVL 3

Author Comment

by:modsiw
ID: 34874076
My command doesn't modify the file at all.

Yours doesn't work; blackslash must be escaped.
0
 
LVL 3

Author Comment

by:modsiw
ID: 34874095
sed 's/\n//g'

doesn't do anything either. I'd expect it to turn the file into a single long line
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 48

Expert Comment

by:Tintin
ID: 34874247
I'd use tr instead

tr -d '\n' <file

Open in new window

0
 
LVL 23

Expert Comment

by:Maciej S
ID: 34878766

sed ':L;$!N;s/\n/\\/g;tL'

Open in new window

0
 
LVL 23

Accepted Solution

by:
Maciej S earned 500 total points
ID: 34878786
Hmm.. a little bit shorter (and simpler) one:
sed ':L;N;s/\n/\\/;tL'

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question