[HELP] Get Line Number using the content of a Line as input #1248
-
Hello friends !!! I have a question about content from a Specific Line. As we know, we can get the content from a specific line like this:
MY QUESTION is about the reverse. Does anybody know how to get the LINE NUMBER using the content of a line as the input? Example: My workflow: I am using Does anybody could help me ? 🙏🙏🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Messing around in one of my random list files and using tp directly i found this works to output the current file line number of a given text: I would imagine this would need to be expanded upon for larger file sizes, but in a pinch and shorter file lengths this is probably fine. note: |
Beta Was this translation helpful? Give feedback.
Messing around in one of my random list files and using tp directly i found this works to output the current file line number of a given text:
<% tp.file.content.split("\n").indexOf("<search_text_here>") %>
I would imagine this would need to be expanded upon for larger file sizes, but in a pinch and shorter file lengths this is probably fine.
note:
.indexOf()
returns 0 on the first element, so you'd need to add one if that matters