Skip to main content
forgot the dash
Source Link
user3082
  • 1k
  • 2
  • 12
  • 18

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

cut doesn't work like that
Source Link
user3082
  • 1k
  • 2
  • 12
  • 18

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

added 8 characters in body; edited title
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

best Best way to partially step through a 25k string?

I have a 25k characters.

I wish to write a script to print (printfprintf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printfprintf through a cutcut command (cut -c -$1cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

best way to partially step through a 25k string?

I have 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

Best way to partially step through a 25k string?

I have a 25k characters.

I wish to write a script to print (printf is most portable I'm told) an arbitrary number of characters; stepping through them in order.

say:

command number

Where number can be any value of 1-25000, and get that output.

I would prefer to not have the data in a separate file (the easiest solution?), and I'd prefer to use only POSIX shell commands (to make the script as portable as possible: I'm aware awk or perl could whack this out simply).

Should I store this data in a variable? Or run my complete printf through a cut command (cut -c -$1)? Or is there another (better?) solution? Why might I choose one option over another option?

What other problems/caveats am I over-looking?

Source Link
user3082
  • 1k
  • 2
  • 12
  • 18
Loading