Suppose I have a html input like
<li>this is a html input line</li> I want to filter all such input lines from a file which begins with <li> and ends with </li>. Now my idea was to search for pattern <li> in the first field and pattern </li> in the last field using the below awk command
awk '$1 ~ /\<li\>/ ; $NF ~ /\</li\>/ {print $0}' but looks like there is no provision to match two fields at a time or I am making some syntax mistakes. Could you please help me here?
PS: I am working on a Solaris SunOS machine.
awk '/^ *<li>.*<\/li> *$/'- I guess needlessly escaping the wedges is your actual error. Notice also how$0is the default forprintand printing is the default in the absence of an explicit action.&&in place of;——awk '$1 ~ /\<li\>/ && $NF ~ /\</li\>/ {print $0}'