Skip to content Skip to sidebar Skip to footer

Html In Unix Shell Scripting With Sequential Output

I have a script called 'main.ksh' which returns 'output.txt' file and I am sending that file via mail.(list contains 50+ records, I just give 4 records for example) mail output I a

Solution 1:

When your code executes this

$NF="<span style=\"color:" color "\">"$NF"</span>"

print $0

the input line is rebuilt and therefore the multiple blanks between two consecutive fields are replaced by just ONE only blank space.

My solution copies the input line in a variable, deletes the last field (changing the value of the variable, not the input line), adds the modified last field and prints:

Dummy=$0
sub("[^ ]+$","",Dummy)   # removes last field
Dummy=Dummy "<span style=\"color:" color "\">"$NF"</span>"print Dummy

Best regards

update: the last two code lines can be reduced in this way:

print Dummy"<span style=\"color:" color "\">"$NF"</span>"

Post a Comment for "Html In Unix Shell Scripting With Sequential Output"