Editing a file using a script

is it possible to modify the script to print the number at the end of lines begining with LINE, instead of at the start?

Yea, just switch one line of code around:

echo "$LINE $number" >> resultFile

Oh yea, there it goes! :slight_smile:

What about printing it in fixed length files? Meaning can I reserve, say, 10 specific spaces in the line to print this number?

I'm just learning here, btw :slight_smile:

Ten specific spaces where? At the end? Not any easy way that I know of, though you could do it with enough programming.. if you know the number is always X digits long, the easiest would just be to stick it at the beginning of the line.

typeset -R10 number

will make number always 10 characters in length. You then need to use quotes to preserve the spaces. Like this...

echo "$number"

the number itself may not always be a specific amount of characters, but it is limited to how many characters it can be, this is up me how many I allow it to be.

For what I'm trying to do (import a fixed length file containing invoices), putting the number at the end or the begining, works fine. I was just curious about 'co-ordinates' :slight_smile:

thanks oombera, I owe you many many many pints :smiley: