Hi,
I need to insert a line at a particular line number. I am using the below code:
sed $REV_LINO_NO" i\\
# $CURRENT_DATE $NAME Changed pwd for cindy\'s id" file > file1
This code works, but the formatting is not as I expected. For example, I get lines as shown below according to the length of the variable '$NAME'
# 20100401 Sudha Changed pwd for cindy's id
# 20100401 Sudhaaaaaa Changed pwd for cindy's id
# 20100401 Su Changed pwd for cindy's id
I have to format the line that I am inserting as shown below:
20100401 Sudha Changed pwd for cindy's id
20100401 Sudhaaaaaa Changed pwd for cindy's id
20100401 Su Changed pwd for cindy's id
i.e I want the 4th feild, "Changed pwd for cindy's id" to start at a fixed place. I tried something with awk as shown below:
echo hi hellll hi | awk '{printf "# %s %s %30s\n", $1,$2,$3}'
but this does not work as I expect.
Your input will be of great help.
Thanks,
Sugan.