Make bold chars in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Make bold chars in UNIX
# 8  
Old 03-18-2015
Quote:
Originally Posted by SekhaReddy
But i want to make this bold chars in flat file.
I mean my target is flat file. While writing the out put to flat file, it needs to make bold in headings. This needs to be achieve via informatica
Woh!!! Didn't know flat files via informatica had styling capabilities like a word processor.
# 9  
Old 03-18-2015
Uhm... "flat file" = "textfile"?
Textfilebold != Terminalbold.

Unless of course you're talking about MD or HTML Smilie
Code:
<b>html bold</b>
##MD bold##

Just got up, but if you tell this one to use ncurses so he has bold for his scripts.. you could use TUI as well.
Though, its 'termcap' too, isnt it?

But at least this kind of code works on Arch, Deb, Freebsd and RH.
Couldnt verify for Solaris just yet, but i'm quite sure it'll work there just fine too.

Code:
:)  $ . tui

+  $ echo "${TUI_FONT_BOLD}Hello${TUI_RESET}"
\033[1mHello\033[0m

✔  $ printf "${TUI_FONT_BOLD}Hello${TUI_RESET} $USER"
Hello sea

Code:
echo $TUI_FONT_<TAB>
$TUI_FONT_BOLD        $TUI_FONT_INVERT      $TUI_FONT_STROKE      $TUI_FONT_UNDERSCORE

hth

Last edited by sea; 03-18-2015 at 11:42 AM..
# 10  
Old 03-18-2015
A flat file is just what it is (generally speaking)... it's text. I you don't plan to use a text editor to view the file, then perhaps what you need to output is something like HTML instead (?). That way you have some markup control than can be interpreted by the end device. If you wan to go totally old school though there is also nroff/troff. Basically the format that raw "man pages" are in. Yep... it's old, but still used.... and in some ways, can be better than something like HTML just because of the number of end device handlers out there (including ones for taking the format to HTML).

Does that make sense? Things like "bold" are terminal (viewing or output device) specific.

---------- Post updated at 09:42 AM ---------- Previous update was at 09:38 AM ----------

Quote:
Just got up, but if you tell this one to use ncurses so he has bold for his scripts.. you could use TUI as well.
Though, its 'termcap' too, isnt it?
Well... because ncurses support both dbs... technically they'll tell you that you must call it a "termcap" package. But it does both. I only mentioned it because the FreeBSD mailling lists indicated that it's one way to get a terminfo db on FreeBSD.
# 11  
Old 03-18-2015
Quote:
Originally Posted by cjcox
Well... because ncurses support both dbs... technically they'll tell you that you must call it a "termcap" package. But it does both. I only mentioned it because the FreeBSD mailling lists indicated that it's one way to get a terminfo db on FreeBSD.
Hmm Smilie
When i search for ncurses on youtube, i see plenty of C-like code, which doesnt look script'ish as php or java script for example.
Though, it could be perl... but then again, the TO asked for a script, and to my believe perl is out of that (general usage) range.

Trying to say:
With my knowledge, to my understanding ncruses seems like its providing a programming language API which then needs to be compiled - and therefor is not a script. (please correct me if i'm mistaken on this)
Furthermore, tput bold is part of ncurses support utilities, which was in this thread said to be not working on some systems.
Code:
$ yum provides tput
Loaded plugins: langpacks
ncurses-5.9-16.20140323.fc21.x86_64 : Ncurses support utilities
Repo        : fedora
Matched from:
Filename    : /usr/bin/tput

Which makes my confusion - perfect Smilie

Thank you

Last edited by sea; 03-18-2015 at 12:03 PM..
# 12  
Old 03-18-2015
yes ncurses is a binary package. On FreeBSD to get a terminfo db, you need the devel part as well.

Scripts use binaries. In *ix it's essential.... scripting gives power to use those binary programs in strange and fabulous ways to do truly interesting things.

---------- Post updated at 11:19 AM ---------- Previous update was at 11:18 AM ----------

Oh.... and tput doesn't have to part of ncurses. It's just that ncurses is a popular package and where it's found on many systems nowadays.

---------- Post updated at 11:20 AM ---------- Previous update was at 11:19 AM ----------

People in general don't seem to care much for terminals anymore... sad, but true.
# 13  
Old 03-18-2015
Quote:
Originally Posted by cjcox
You really do *not* want to hardcode terminal escapes since they are terminal dependent. Better to query capabilities.

[..].
Well, it is provided as an alternative in this thread (since it will work in many terminals) in case tput does not work as expected, since it is not required by the standards, at least it is only required to support clear, init and reset:

Code:
OPERANDS

The following strings shall be supported as operands by the implementation in the POSIX locale:

clear
      Display the clear-screen sequence.
init
      Display the sequence that initializes the user's terminal in an implementation-defined manner.
reset
      Display the sequence that resets the user's terminal in an implementation-defined manner.

If a terminal does not support any of the operations described by these operands, this shall not be considered an error condition.

tput: operands

so tput is not guaranteed to always produce the right result...

Last edited by Scrutinizer; 03-18-2015 at 04:55 PM..
# 14  
Old 03-18-2015
tput POSIX maybe not, because POSIX != *ix (as weird as that sounds). But tput (with terminfo) will work on Solaris, HP-UX, AIX, Linux, NetBSD, OpenBSD, SVR4 implementations, SVR3 implementations and most all SVR2 implementations.

Which is why I was surprised that FreeBSD didn't go that way.

So... really, I think it's probably best to say tput with terminfo capabilities doesn't work on FreeBSD but works (practically speaking) everywhere else :-)
This User Gave Thanks to cjcox For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. Shell Programming and Scripting

Removing formats (bold) from UNIX file

Hi , Could you please guide me how to remove formatting (bold text) in a unix file? vi editor showing like this... ^ Cat command showing like this... tl21ss01 tl21ss02 tl21ss03 (6 Replies)
Discussion started by: suresh3566
6 Replies

3. Shell Programming and Scripting

Bold chars redirect to CSV

Is there any way to redirect characters in bold to .csv file using KSH. I need to open this csv in MS EXCEL. thanks (4 Replies)
Discussion started by: param_it
4 Replies

4. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

5. Programming

Unix Make

I need tutorial on Make utility on Unix. Any help or link appreciated. many thanks Mirko (3 Replies)
Discussion started by: mmipko
3 Replies

6. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

7. UNIX for Dummies Questions & Answers

How can i make this bold

Folks; I'm writing this as a part of a script: echo "col1 hdg|col2hdg|col3hdg|" How can i make these fields shows in Bold text? (10 Replies)
Discussion started by: moe2266
10 Replies

8. UNIX for Dummies Questions & Answers

how to make a bold text in vi

pls disregard got my question answered . as you can't do bold in vi (0 Replies)
Discussion started by: xzyan
0 Replies

9. Shell Programming and Scripting

Hidden chars in Unix can be replaced?

We have some unseen chars in unix, like '^T's, can be seen with 'cat -v' command. Is there any way, with which, we can replace these ^T s with a space? (1 Reply)
Discussion started by: videsh77
1 Replies

10. Programming

How can I make ls -l in HP-UNIX?

I made a liitle source about that.. BUt I got a trouble when making files'authority.. How can I display them?? p.s.) used struct stat .. (1 Reply)
Discussion started by: sangjinn
1 Replies
Login or Register to Ask a Question