Skip to main content
edited title
Link
dr.blochwave
  • 8.8k
  • 3
  • 43
  • 76

Printing every other line from input text in _Mathematica_

Printing every other line from input text in Mathematica_Mathematica_

I am trying to do some text manipulation mathematicain Mathematica.

  After importing a text file (in.txt) as a string, how would you then output every other line into a new txt?

  In the command line using awk for instance one would do awk 'NR % 9 != 8' in.txt

awk 'NR % 9 != 8' in.txt

However, after looking through the documentation MathematicaMathematica doesn't seem to have any current line number querying mechanism. Do you need to split the input string on every new line and then work with the list of stringstrings? Or is MathematicaMathematica not the best choice for manipulating text?

Printing every other line from input text in Mathematica

I am trying to do some text manipulation mathematica.

  After importing a txt as a string, how would you then output every other line into a new txt?

  In the command line using awk for instance one would do awk 'NR % 9 != 8' in.txt

However after looking through the documentation Mathematica doesn't seem to have any current line number querying mechanism. Do you need to split the input string on every new line and then work with the list of string? Or is Mathematica not the best choice for manipulating text?

Printing every other line from input text in _Mathematica_

I am trying to do some text manipulation in Mathematica. After importing a text file (in.txt) as a string, how would you then output every other line? In the command line using awk for instance one would do

awk 'NR % 9 != 8' in.txt

However, after looking through the documentation Mathematica doesn't seem to have any current line number querying mechanism. Do you need to split the input string on every new line and then work with the list of strings? Or is Mathematica not the best choice for manipulating text?

Tweeted twitter.com/#!/StackMma/status/642943416029061120
Source Link
1110101001
  • 2k
  • 13
  • 26

Printing every other line from input text in Mathematica

I am trying to do some text manipulation mathematica.

After importing a txt as a string, how would you then output every other line into a new txt?

In the command line using awk for instance one would do awk 'NR % 9 != 8' in.txt

However after looking through the documentation Mathematica doesn't seem to have any current line number querying mechanism. Do you need to split the input string on every new line and then work with the list of string? Or is Mathematica not the best choice for manipulating text?