Bash removing sysmacros.h from GCOV


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash removing sysmacros.h from GCOV
# 1  
Old 10-14-2009
Bash removing sysmacros.h from GCOV

Hey.

GCC GCOV now outputs a file called sysmacros.h as part of its results.

How can I remove it from the html?

The tags looks like this:

<tr bgcolor="e0f0d0">
<td bgcolor="dae7fe" style="padding-top: 3px; padding-left: 30px; padding-bottom: 3px; padding-right: 30px;"> /bin/../lib/gcc/mips-linux-uclibc/4.2.0/../../../../mips-linux-uclibc/sys-include/sys/sysmacros.h </td>
<td bgcolor="lightgreen" align="center"> 100.00% </td>
<td bgcolor="dae7fe" align="center"> of </td>
<td bgcolor="dae7fe" align="center">0</td>
</tr>

How can I search and remove this from the html? Grep doesnt work over multiple lines, sed/awk?

Thanks,
Ryan

---------- Post updated at 08:42 AM ---------- Previous update was at 08:06 AM ----------

Maybe something like:

cat $filename | sed 's/^<tr bgcolor="e0f0d0">.*sysmacros.h.*<\/tr>//g'

but sed wildcards doesnt work across multiple lines.

Anyone?

---------- Post updated at 10:09 AM ---------- Previous update was at 08:42 AM ----------

Or possibly:

grep -A1 -B4 -v "sysmacros.h" $filename

but you cant use after & before context with the invert option (-v)
How do I use them both?
# 2  
Old 10-14-2009
Try this:

Code:
awk '/tr bgcolor="e0f0d0/{f=1} /\/tr/{f=0;next} !f' file

# 3  
Old 10-14-2009
Something like this:

Code:
sed '
  /^<tr bgcolor="e0f0d0">$/,/^<\/tr>$/d
  ' infile

# 4  
Old 10-14-2009
Quote:
Originally Posted by Franklin52
Try this:

Code:
awk '/tr bgcolor="e0f0d0/{f=1} /\/tr/{f=0;next} !f' file

Awesome. It works Smilie

changed it slightly to:

awk '/.*sysmacros.h.*/{f=1} /\/tr/{f=0;next} !f' $filename > $newfile

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash not removing all .tar.bz2 files after extracting

In the bash below each .tar.bz2 (usually 2) are extracted and then the original .tar.bz2 is removed. However, only one (presumably the first extracted) is being removed, however both are extracted. I am not sure why this is? Thank you :). tar.bz2 folders in /home/cmccabe/Desktop/NGS/API ... (3 Replies)
Discussion started by: cmccabe
3 Replies

2. UNIX for Dummies Questions & Answers

BASH - Removing the very last character(s) extension of a filename

Hello. I would like to know how to do this in bash script : A_WORD="ABCD_EFGH.0.100.40.123" NEW_WORD=remove_last_ext("A_WORD") NEW_WORD --> ABCD_EFGH.0.100.40 A_WORD="ABCD_EFGH.0.50.3" NEW_WORD=remove_last_ext("A_WORD") NEW_WORD --> ABCD_EFGH.0.50 A_WORD="ABCD_EFGH.3.100.50." ... (2 Replies)
Discussion started by: jcdole
2 Replies

3. Shell Programming and Scripting

bash script removing files except last one created

Hello there, can anyone please help to write a bash script that can achieve the following: 1) list files that contain a certain string in order of their creation date. Ideally the script should ask me to type in the string by hand. 2) use that list and remove all except the last one created... (2 Replies)
Discussion started by: kjartan
2 Replies

4. Shell Programming and Scripting

Need script to remove GCOV flags from Qt project file

Hi, I have the following gcov compilation flags in all the QT source code project (*.pro) files. CONFIG(gcov) { LIBS += -lgcov QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage } Now, I want to remove these flags off my files. Please help me with a script to... (1 Reply)
Discussion started by: royalibrahim
1 Replies

5. Programming

Using gcov

Hi, I am using gcov to get code coverage for my program written in C++, I am able to do it without any problem when i don't have a directory structure, for my program I am a directory structure as below ./src/ -- containing all my source files ./obj/ -- containing all my object... (0 Replies)
Discussion started by: niranjanvg
0 Replies

6. Shell Programming and Scripting

best way for removing comment from shell scripts -- bash

Again a comment removal requirement from me, refer my previous problem & solution for removing comment from ruby scripts: https://www.unix.com/shell-programming-scripting/118296-best-way-removing-comment-ruby-program.html This time, it is for stripping of comments from Shell Script. I search for... (2 Replies)
Discussion started by: thegeek
2 Replies

7. Shell Programming and Scripting

bash hell , removing " and adding from a strings

I'm writing a bash script and i'm stuck the out put of a dialog menu is echo $select "foo" "bar" "lemon" cheese" while I need $foo $bar $lemon $cheese to reuse them as strings later in the script and very new to bash scripting and i've no idea how to do this any help would be... (2 Replies)
Discussion started by: xpd259
2 Replies

8. Shell Programming and Scripting

Bash Script - Removing Year and Text from File Name

Hi, I have files with names in the following naming pattern, Name.of.moviemoretext-moretext.mov or Name of moviemoretext-moretext.mov And I would like to delete the and moretext-moretext leaving just the Name of movie. The Name of movie will always be different and the year will... (4 Replies)
Discussion started by: Monkey Dean
4 Replies

9. Linux

GCOV : struct bb

Hi, I am working on gcov.Meaning, analysing the functionality of gcov. There is one structure called "struct bb". I am not sure, how struct bb members are getting assigned values. If anyone knows how it is happening pls let me know. Thanks in advance. --Vichu (0 Replies)
Discussion started by: Vichu
0 Replies

10. Debian

Application link error with gcov

Hi, I'm trying gcov on my Debian VM. gcov (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Copyright (C) 2006 Free Software Foundation, Inc. It work with example program, but I got link error in my application code. C_FLAGS += -Wall -W -O0 -fprofile-arcs -ftest-coverage Each class... (1 Reply)
Discussion started by: clho
1 Replies
Login or Register to Ask a Question