# Long text export

**URL:** <https://discourse.nodered.org/t/long-text-export/74062>\
**Category:** General\
**Created:** [22 January 2023 21:02 UTC](https://discourse.nodered.org/t/long-text-export/74062 "2023-01-22T21:02:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![danieleronchi](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@danieleronchi](https://discourse.nodered.org/u/danieleronchi)\
**Post date:** [22 January 2023 21:02 UTC](https://discourse.nodered.org/t/long-text-export/74062/1 "2023-01-22T21:02:04Z")

</div>

Good evening,  
i need to export in a .txt file a long text modified by some funcion.  
The example of text is

```auto
0
0
0

```

{{{some var}}}

```auto
0
0
0

```

I've try something like

```auto
var a = 0
0
0
0

```

but this is not correct.

Any ideas?  
Thank you!

---

<div class="post-metadata">

**Author:** ![waldbaer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waldbaer/32/74212_2.png) [@waldbaer](https://discourse.nodered.org/u/waldbaer)\
**Post date:** [22 January 2023 21:21 UTC](https://discourse.nodered.org/t/long-text-export/74062/2 "2023-01-22T21:21:41Z")

</div>

I don't fully understand your usecase.  
But maybe multiline string formatting does the trick?

```auto
msg.payload = `
0
0
${msg.payload}
0
0`;

return msg;

```

---

<div class="post-metadata">

**Author:** ![danieleronchi](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@danieleronchi](https://discourse.nodered.org/u/danieleronchi)\
**Post date:** [22 January 2023 21:29 UTC](https://discourse.nodered.org/t/long-text-export/74062/3 "2023-01-22T21:29:50Z")

</div>

Thank you walbaer, it words perfectly!

---

<div class="post-metadata">

**Author:** ![danieleronchi](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@danieleronchi](https://discourse.nodered.org/u/danieleronchi)\
**Post date:** [30 January 2023 21:08 UTC](https://discourse.nodered.org/t/long-text-export/74062/4 "2023-01-30T21:08:40Z")

</div>

Good evening waldbaer,  
i need to ask you something more.  
I have file, that i read from "read file" function.  
Can i change some line of this text like you did in your example?  
I've tried to change the original file with ${variable} in specified point but the result is ${variable} also in the output.

Thank you!

---

<div class="post-metadata">

**Author:** ![waldbaer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waldbaer/32/74212_2.png) [@waldbaer](https://discourse.nodered.org/u/waldbaer)\
**Post date:** [5 February 2023 22:09 UTC](https://discourse.nodered.org/t/long-text-export/74062/5 "2023-02-05T22:09:09Z")

</div>

@danieleronchi please provide some more context and concrete function code you are using.

Modifying 'any' line of a parsed file depends on the file content.  
Either the content is a parsable format you can parse, modify structured data, export.  
Or you know exactly the location you want to modify (e.g. the line number, character number etc).

But a general answer is not possible here if I must assume that you just have a text file with random content. A file ist in principle just a long chain of bytes. Even characters can be encoded with many different encodings etc.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 February 2023 22:09 UTC](https://discourse.nodered.org/t/long-text-export/74062/6 "2023-02-19T22:09:46Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
