I want to make a script to read row by row and find its length. If the length is less than my required length then i hav to append spaces to that paritucular row. Each row contains special characters, spaces, etc.
For example my file contains ,
12345 abcdef
234 abcde
89012 abcdefgh
Each row should be of length 15, if any row is less than 15 then for the remaining length spaces should be appended.
The below code do not appened spaces as many as my required length. When i gave length as 285, it append spaces upto 251 only. When i use printf command it shows 285.
But when i write the output to a file, in that the length is only 251 but not 285.
Any proposal above does work on my system, giving lines of 285 chars in total. Do you have limitations on line length or similar?
Post samples of input & output files.