grep value from html file
I have 200 html files that contain information such as Filename, Filetype, total Sequences etc. Please see attached the screenshot
I need to grep the Filename and Total Sequences from the Value column (in this screenshot I need IGM17-B_S162_read_1.fastq and the value 9237623) and save it in a seperate.txt file.
May be with grep or cat command. Again, these are html files.
I would really appreciate help from anyone who's expert in writing the script in the command line.
• 1,726 views
•
link
1 answer
html produced by fastqc in XML+HTML, so you can use a XPATH expression to extract things.
$ xmllint --xpath '//tr[td[1]/text()="Filename"]/td[2]/text()' fastqc_report.html
jeter.fastq.gz
xmllint --xpath '//tr[td[1]/text()="Total Sequences"]/td[2]/text()' fastqc_report.html
147142898
fastqc also comes with a text file fastqc_data.txt
$ grep -E '(Filename|Total Sequences)' fastqc_data.txt
Filename jeter.fastq.gz
Total Sequences 147142898
• 0 views
•
link
Log in to answer this question.
This can be done, but it seems that you wish to aggregate FastQC reports and possibly other logfiles. So maybe you want to try MultiQC first before trying to come up with an own solution?
This may be a fun read https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454