in reply to extra spaces between the characters in string

You said you want to remove the first word, but in your example of input and desired output it seems you're removing the leading numbers. Is that what you really meant to say?

I don't really think that substr is the right tool for the job... at least not when Perl provides such powerful regexp tools.

use strict; use warnings; s/^\d+// && print while <>;

Invoke it like this:

myscript intext.txt > outfile.txt

Or as a Perl one-liner:

perl -p -e 's/^\d+//' infile.txt > outfile.txt

Of course it's always advisable to skip the redirection on the first run through the script so that you can see on screen if your output is going to be what you want.


Dave

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.