+ operator in awk FS string

Posted on 2008-11-13
Last Modified: 2012-06-21
I'm parsing a HTML file witk awk, and I want my field separator to be any sequence of <> tags, leaving fields as the text outside of the tags.

Currently I have
FS = "[ \t]*<[^>]*>[ \t]*"
which works well for one tag (and any surrounding whitespace), but gives lots of empty fields when several tags <b><i> etc are next to each other.

I'd like something like
FS = "[[ \t]*<[^>]*>[ \t]*]+"
but that doesn't work. I've tried a number of permutations with brackets, parentheses and plus signs.

What's the proper way of doing this?
Question by:loveslave
    1 Comment
    LVL 84

    Accepted Solution

    ([ \t]*<[^>]*>[ \t]*)+

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now