Mac OS forum


Formatting text with sed using iTerm2

by pmdulaney / April 14, 2013 8:23 AM PDT

In order to make the results of my sed filtering more visible, I would like, when I replace OLD with NEW to underline NEW. I'm using the tcsh shell. So, what I want is something like:

cat file | sed 's/OLD/NEW/g' | more

but I want NEW to be underlined. If you have an answer please give sufficient detail; i.e., please do not assume I know anything but basic sed. Thanks.

Answer This Ask For Clarification
Discussion is locked
You are posting a reply to: Formatting text with sed using iTerm2
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Formatting text with sed using iTerm2
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Clarification Request
Ascii text?
by R. Proffitt Forum moderator / April 14, 2013 8:27 AM PDT

I've never seen underlining in an Ascii text file. You may have to reveal more.

Collapse -
Attempt at clarification
by pmdulaney / April 14, 2013 8:41 AM PDT
In reply to: Ascii text?

Well, I'm not sure if it's considered ASCII or not, but iTerm2 can display bolded and underlined text. I would actually want to create two versions of my sed script: one (without the underline feature I'm seeking here) for writing to a new file, and another for viewing with more on the terminal where I could just easily tell what's changed.

Collapse -
I see a forum just for iTerm2 at link.
by R. Proffitt Forum moderator / April 14, 2013 8:51 AM PDT

I'm just an old programmer and a text file is, in my definition "ASCII" and as such has no underline. Now there are editors that will underline when they display web links and such but this is not in the source file but in some rules file.
Popular Forums
Computer Help 49,613 discussions
Computer Newbies 10,349 discussions
Laptops 19,436 discussions
Security 30,426 discussions
TVs & Home Theaters 20,308 discussions
Windows 10 360 discussions
Phones 15,802 discussions
Windows 7 7,351 discussions
Networking & Wireless 14,641 discussions


Free trip to the Grand Prix

Don't miss your chance to win a trip to the Formula 1 Grand Prix in Monaco for you and a plus-one.