Search for bold text in Bash?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

Search for bold text in Bash?

#1 Post by slavvo67 »

Is there any way to search in bash (maybe grep or sed?) for text that would be bold in say a word document, ABI Word document or maybe Libre or Open Office documents? What I'm really looking to do is identify bold text and copy the text and page # to a new file. Basically, saving me the time of creating a directory on a 200+ page document.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Search for bold text in Bash?

#2 Post by L18L »

slavvo67 wrote:Is there any way to search in bash (maybe grep or sed?) for text that would be bold in say a word document, ABI Word document or maybe Libre or Open Office documents? What I'm really looking to do is identify bold text and copy the text and page # to a new file. Basically, saving me the time of creating a directory on a 200+ page document.
created an abiword text file slavvo67.abw containing
a bold text
and made bold the word bold

Open the the abw file in text editor geany and you will see how abiword is storing "bold". Then you might use grep.

Code: Select all

# grep font-weight:bold slavvo67.abw
answered:

Code: Select all

<p style="Normal" xid="2"><c>a </c><c props="font-weight:bold">bold</c><c> word</c></p>
#
There is a program that removes all tags elsewhere or just use sed.....

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#3 Post by slavvo67 »

L18L

Thanks. That was a step in the right direction!

I chopped out the other stuff with sed:

sed -e 's/.*>\(.*\)<.*/\1/'

Post Reply