# Only the first 200

**URL:** <https://discourse.nodered.org/t/only-the-first-200/51953>\
**Category:** General\
**Created:** [7 October 2021 06:45 UTC](https://discourse.nodered.org/t/only-the-first-200/51953 "2021-10-07T06:45:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [7 October 2021 06:45 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/1 "2021-10-07T06:45:07Z")

</div>

Hello!

I have a CSV file with 20000 lines.

Is there a possibility and that only the first 200 will be taken over?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [7 October 2021 10:36 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/2 "2021-10-07T10:36:24Z")

</div>

What do you mean by ‘taken over’? You need to give a little more detail if you want some help.

---

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [7 October 2021 10:57 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/3 "2021-10-07T10:57:04Z")

</div>

Hello!

When I read out the CSV file, I have 20000 data sets.

Of the 20000 data sets I only need the first 200.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [7 October 2021 11:37 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/4 "2021-10-07T11:37:45Z")

</div>

If you are on Linux you could use an Exec node **head -200 /full/path/to/file.csv** , maybe with a Split node to generate one message per line.

---

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [8 October 2021 05:24 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/5 "2021-10-08T05:24:41Z")

</div>

> [@jbudd](#):
>
> If you are on Linux you could use an Exec node **head -200 /full/path/to/file.csv** , maybe with a Split node to generate one message per line.

Hello!

Thank you for your mail.

That must be possible in Node Red. Doing something about an Exec is not the purpose.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 October 2021 06:02 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/6 "2021-10-08T06:02:51Z")

</div>

Head is a good tool for this job, and the exec node is a good way to use that from Node-RED.

You could use a file in node to read the file in line at a time mode, then a switch node to look as msg.parts.index to see the line count and pass on only those less than 200, but it still read in and dump the test of the file , which may not be very efficient .

---

<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:** [7 December 2021 06:03 UTC](https://discourse.nodered.org/t/only-the-first-200/51953/7 "2021-12-07T06:03:36Z")

</div>

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