Comments (1)
El código anterior todavía tenía problemas con líneas que tenían información del tipo "< 5 minutes". El siguiente código ya soluciona esto.
function extract_table() {
# get table
sed -n '/<TABLE .>/,/</TABLE>/p' $1 |
# Fill non-responses with NA's
sed 's/
/NA/g' |
# Remove double NA's
sed 's/NANA//g' |
# Remove HTML code
sed 's/<[^<>]>//g' |
# Remove ^M delimiters
sed 's/\r//g' |
# Remove empty lines
awk '/.+/ {print $0}' |
# Remove tabs
sed 's/\t/ /g' |
# Remove pipes
sed 's/|/ /g' |
# Add pipes to lines that should be the end of lines
awk '{if (NR %7 == 0) {print $0"|"} else {print $0}}' |
# Paste all lines together in one line with tabs as separator
sed -e :a -e '$!N; s/\n/\t/; ta' |
# Separate lines using the added pipe
sed 's/|/\n/g' |
# Remove tabs at the begining of the lines
sed 's/^\t//g' |
# Remove emplty lines.
awk '/.+/ {print $0}'
}
from programming-for-data-science-2019.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from programming-for-data-science-2019.