Question: We are having a file in Linux which contains one line per record, but problem comes when the line contains some new line characters. In this case, the backslash is appended at the end of line and the record is split into multiple lines. So below is my problem:

```
"abc def \
xyz pqr"

```

should be:

```
"abc def xyz pqr"

```

I tried `sed -I 's/\\\n/ /g' <file_name>` which is not working. I also tried the `tr` command but it replaces only one character, not the string. Can you please suggest any command to handle this issue.

Answer: 
You should be able to use

```
sed -e :a -e '/\\$/N; s/\\\n//; ta'

```

See Peter Krumins' [Famous Sed One-Liners Explained, Part I](http://www.catonmat.net/blog/sed-one-liners-explained-part-one/), **39. Append a line to the next if it ends with a backslash "\"**.
You can use `awk`:

```
$ awk 'sub(/\\$/,""){printf("%s", $0);next};1' file
"abc def xyz pqr"

```