Add characters at specific position in file

Hello

I want to add some value at the specific position.
My file has data like

Hello
Welcome to UNIX Forums
Need Assistance

I want to add some value at the end but at same character position for all lines.

I want my output file to have data like :

Here '_' represents blanks.

Hello_____________________Everyone

Welcome to UNIX Forums____Everyone

Need Assistance___________Everyone

The data to be appended at last is same.

I am using this command :

 
sed "s/$/'Everyone'/" myfile

However it is appending where my line is ending.i.e.

Hello'Everyone'
Welcome to UNIX Forums'Everyone'
Need Assistance'Everyone'

Any suggestions.[COLOR="\#738fbf"]

Something like this:

awk '{len=30-length;printf("%s%*s\n",$0,len,"Everyone")}' file

You can use "printf" to format the input to the specified length. See the printf manual for complete syntax.

Thanks for valuable reply...

I am using this command .

 
awk '{len=4000-length;printf("%s%*s\n",$0,len,$var1$var2)}' $FILE

However I am getting an error :

awk: Field is not correct .The input line number is 1.The file is /.../abc.txt . 
The Source line number is 1.

Please help me in correcting this error.

---------- Post updated at 04:56 PM ---------- Previous update was at 04:21 PM ----------

THANK YOU EVERY ONE !!!

UNIX FORUMS ROCKK !!!:cool:

I GOT THE SOLUTIONS.:smiley:

I LEARNED THAT I NEED TO PUT MY VARIABLES IN "'" QUOTES INSIDE AWK...:wink:

CHEERS !!!:slight_smile: