0

How do I bold the "Date & Time" numbers from the following file with the tput command (I have a Solaris machine)?

For example, I want to bold only the "24-09-2009 16:17:45", etc. for all other date and time.

The tput will write in my ksh script.

  TIMESTAMP               SET_ID TELEPHONE                    No TYPE
  ------------------- ---------- -------------------- ---------- ------------------

  24-09-2009 16:17:45          0 33633333333                  20 other_mms_phone
  24-09-2009 17:45:07          0 33644444444                  20 other_mms_phone
  07-10-2009 10:45:49          0 12312312312                  20 legacyphone
  07-10-2009 11:46:38          0 59320000043                  20 other_mms_phone

try solution by this - but not work on my solaris machine ?

       awk 'NR>2' output.csv | sed 's/^\(.\{2\}\)\(.\{19\}\)/\1'$(tput rmso ) '/' 

Illegal variable name.

1 Answer 1

0
awk 'NR>2' inputfile.txt |\
sed 's/^\(.\{2\}\)\(.\{19\}\)/\1'$(tput smso)'\2'$(tput rmso)'/'
  1. awk skips the header,
  2. sed picks all character up to character 2 and puts them in group \1, and the next 19 characters and puts them in group \2, and then inserts tput smso and tput smso (start and end bold according to man tput) before and after group 2.
3
  • see my update in my question ( i get error - Illegal variable name.)
    – yael
    Apr 17, 2012 at 20:13
  • Yeah, well, you haven't copied my command. The error you get is because of the added spaces in your try (specifically the second), but you are also completely missing parts of the sed expression. Just copy my line and it will work. Apr 18, 2012 at 6:42
  • @yael: forgot to highlight. Read above comment. Apr 18, 2012 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .