-3

Can someone please help in adding a command for enter in a .txt file to emulate enter.

Example:
12345enter548793enter.....

where an entry will be a number followed by enter to next field where the next number will be inserted etc.. so it will look like this:

12345
548793
etc...
H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
gary
  • 1
  • 1
  • What language (or tool) do you want to use to accomplish this? If you need help on what tool to use, indicate the operating system that you are using. – Tim Post Apr 12 '10 at 16:44
  • 3
    Could you explain what you're trying to achieve, besides adding a newline after each number ? – nos Apr 12 '10 at 16:44
  • Depending on which OS it uses, hitting enter will send a combination of the ASCII carriage return (hex 0x0D / dec 13) and line feed (hex 0x0A / dec 10). Most likely just line feed, as only Windows tends to use both. – Powerlord Apr 12 '10 at 16:46
  • Question is extremely unclear. Clarify or delete. – Nate Apr 12 '10 at 16:50

3 Answers3

1

There is a difference between an enter and a return (-- old skool typewriter stuff - check Wikipedia on that).

One is a carriage return and one is a line feed; the ASCII codes for those are 10 and 13, I'd say test and find out which one (if not both) you'll need.

Normally (in like C++,C#,etc) you'd post \r\n --> 10 13

riffnl
  • 3,248
  • 1
  • 19
  • 32
  • im importing a series of numbers which were captured by a scanner. the numbers are separated by a comma. I would like to insert a enter command in between the numbers so i can copy and paste from a notepad.txt into a spreadsheet in a column format. – gary Apr 12 '10 at 19:15
  • Now that's more information then you've left in the original post; What programming language are you using to achieve this? – riffnl Apr 13 '10 at 08:34
0

Just add newlines in the file?

12345
548793
etc...
jonnystoten
  • 7,055
  • 2
  • 28
  • 36
  • I think he has a file where "ENTER" (case insensitive) should be replaced with a newline. The problem is what tool / language he hopes to use to substitute string literals for newlines. – Tim Post Apr 12 '10 at 16:47
  • im importing a series of numbers which were captured by a scanner. the numbers are separated by a comma. I would like to insert a enter command in between the numbers so i can copy and paste from a notepad.txt into a spreadsheet in a column format – gary Apr 12 '10 at 19:16
0

The script that is reading in your txt file should already recognize whichever EOL character the text editor used. Many scripting languages automatically understand the various EOLs when reading from a filehandle. If yours doesn't, you may have to compose a regex that looks for the most common ones.

dnagirl
  • 20,196
  • 13
  • 80
  • 123