Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to modify the cat command to highlight a chosen word? Post 302974838 by RudiC on Saturday 4th of June 2016 01:58:00 PM
Old 06-04-2016
I'm afraid, no. cat does exactly this:
Quote:
cat - concatenate files and print on the standard output
You CAN make it show some special chars, too, but that's it.

BTW, "highlighting" is quite fuzzy an action. What is "highlight"? Print in bold? in red? underlined? Do it when outputting to screen? Printing? Sending it with mail, or putting it in an HTML file? All those MAY have different mechanisms to highlight.

You could do some text modifications with e.g. sed, e.g. when outputting to a VT102 (ECMA-48) compatible terminal:

Code:
sed "s/AM0./$BOLD&$OFF/" file
000000000001AM00 1500895700000000000199
000000000001AM01 035000000000013000399820810000000P

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to move word by word on command line

Hey All, On commad promt of a shell.. How can we move our cursor word by word. Like Ctrl+A takes to the starting of the command... Any shortcut like that..? Thanks pbsrinivas (1 Reply)
Discussion started by: pbsrinivas
1 Replies

2. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

3. Shell Programming and Scripting

cat/delete per line any word "192.168.1.12"

Hi All Can u help me.. My problem is delete word per line sample: cat /tmp/file.txt monitor 192.168.1.11 Copying files in current directory 1 monitor 192.168.1.1 Copying files in current directory 2 monitor 192.168.1.12 Copying files in current directory 3 monitor 192.168.1.14... (1 Reply)
Discussion started by: carnegiex
1 Replies

4. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

5. AIX

find command modify the output

Hello All, I am new to this shell scripting , I wanted to modify the output of my find command such that it does not display the path but only file names , for example I am searching for the files which are modified in the last 24 hours which is find /usr/monitor/text/ -type f -mtime... (3 Replies)
Discussion started by: raokl
3 Replies

6. Linux

help to print all the contents under chosen records in perl

Hi, I have a file in which I have to separate genes from phenotype data. I have written a program as given below which prints just the gene records. 1. But I want to print all the data under each specified record to the output file. So the file has all the data like for every record. An example... (2 Replies)
Discussion started by: kaav06
2 Replies

7. Shell Programming and Scripting

get chosen value from bash menu

Hi again :) This is just a sample whiptail menu. Works great, but have been trying to get the chosen value into a variable but failing pretty bad...its ther but unsure how to echo it out when needed #! /bin/bash #This is the menu whiptail --title "Menu example" --menu "Choose an... (9 Replies)
Discussion started by: olearydc
9 Replies

8. UNIX for Dummies Questions & Answers

How to modify the script to include cat function

I have the following script that greps lines containing "AT" from data files data1.hsq through data1000.hsq, then cuts their second column and puts in data files called perm1 through perm1000. I want to modify the script so that instead of putting the data in separate data files perm1 through... (2 Replies)
Discussion started by: evelibertine
2 Replies

9. Shell Programming and Scripting

Copying xml files to a chosen directory

I want to determine if there's any xml files exist & if so copy each xml to that directory. Is my code correct for doing that? I can't test my script yet. Somebody please explain it to me please? if ]; then #print "No Status type XML files received from server in $DIRECTORY" else for... (2 Replies)
Discussion started by: emc^24sho
2 Replies

10. Shell Programming and Scripting

Highlight 'comm' command output

Given the output below (simplified) extracted from the comparison of two curl -I commands saved in two different files, I am looking for the best approach to highlight the following scenarios in a script: this header exists only in file1.txt but this one does not this one exists in both cases... (1 Reply)
Discussion started by: muppets
1 Replies
richtext(1)						      General Commands Manual						       richtext(1)

NAME
richtext - View a richtext document, typically a mail message SYNOPSIS
richtext [ -c ] [ -f ] [ -m ] [ -n ] [ -o ] [ -p ] [ -s charset ] [ -t ] [ file ] DESCRIPTION
The richtext program allows users to view "richtext" files on an ASCII terminal. It uses termcap(5) capabilities to highlight text that is supposed to be bold or italic, and to underline text that is supposed to be underlined. It also implements most of the richtext commands that have to do with indentation and justification, as well as the "excerpt" and "signature" commands. Richtext is a very simple markup language for sending rich text through the mail. It is not to be confused with Microsoft's RTF (Rich Text Format). It is part of the MIME standard for multimedia Internet mail. The richtext program takes raw richtext output on its standard input or from a file and produces formatted output on its standard output, which is assumed to be a terminal. It is intended primarily for use by the metamail(1) program. The program will also repair the raw input to match up any richtext command pairs that are out of order. OPTIONS
When invoked with no options, richtext expects raw richtext on its standard input, which is corrected, and then formatted output is written on its standard output. The following options can alter that behaviour: -a This option, which is only available under DOS, toggles whether or not to use ANSI mode for highlighting bold, italic, or under- lined text. -c This option directs richtext to just correct the raw richtext and write the corrected version to its standard output, without per- forming any formatting. -f This option directs richtext to use termcap-derived escape codes for bold and italic text, even if richtext is called in a pipe. -m This option directs richtext to interpret '<' in multi-byte Japanese and Korean sequences as a real less-than symbol and not the start of a richtext command. This is called the ''multi-byte '<' hack'' in the source code. Primarily this is for international variants of richtext. -n This option directs richtext to not do any correction to the raw richtext it receives. -o This option directs richtext to use overstriking for underlining, etc., on terminals where this is the most appropriate behavior. -p This enables the use of a pager which reports "Press RETURN to go on" after each screen-full of data. Alternatively, if the envi- ronment variable MM_USEPAGER is present, then the pager will also be used. This option and the environment variable have no effect if either standard input or standard output is redirected. -s charset This option directs richtext to use the specified default character set initially when processing the text. Legal values are us- ascii, iso-2022-jp and iso-2022-kr. Any other value will default to us-ascii. -t This option directs richtext NOT to use termcap-derived escape codes for bold and italic text, even if richtext is called in a ter- minal. Instead, "*" and "_" will be used to highlight the affected text. X11 Resources If you're using the xterm program, you can control what font is used for bold text using the "xterm*boldFont" resource. SEE ALSO
metamail(1), mailto(1), termcap(5) BUGS
This is a very quick hack, really -- an attempt to provide minimal richtext support for an ASCII terminal. The author makes no pretense of having gotten every single case right. COPYRIGHT
Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore) Permission to use, copy, modify, and distribute this material for any purpose and without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies, and that the name of Bellcore not be used in advertising or publicity pertaining to this material without the specific, prior written permission of an authorized representative of Bellcore. BELLCORE MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. AUTHORS
Nathaniel S. Borenstein Richtext correction algorithm and international language support by Rhys Weatherley (rhys@cs.uq.oz.au). Release 1 richtext(1)
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy