Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted
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.
share|improve this answer
see my update in my question ( i get error - Illegal variable name.) – yael Apr 17 '12 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. – Daniel Andersson Apr 18 '12 at 6:42
@yael: forgot to highlight. Read above comment. – Daniel Andersson Apr 18 '12 at 9:39

You must log in to answer this question.

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