3 ms·
There's loads of things you can easily do with tools and I'm sure someone will come up with something, but sometimes it's just easier to use Python: cat da
by lucb1e 10y ago
There's loads of things you can easily do with tools and I'm sure someone will come up with something, but sometimes it's just easier to use Python:
cat dates | python -c 'import sys; for line in sys.stdin: print(line.split("<td>"))'
Or PHP
php -r 'foreach (explode("\n", file_get_contents("dates")) as $line) { print_r(explode("<td>", $line)); }'
Or with Perl or Ruby or whatever floats your boat.
While writing this I did think of something though, depending on what you're actually trying to do it might work:
cat dates | tr "<>" " " | awk '{print $yourColumnOfInterest}'
- peterburkimsher 10y agoAs I say, "High-level scripting languages handle all of these just fine". Back to the article. dd is not a disk writing tool. Everything on UNIX is a disk writing tool. dd has one job, and does it right. Again, I propose a single-purpose text delimiter cutting program. It doesn't need to be a whole scripting language, e.g. awk, perl, python, etc. Just get the text between two strings, and have sensible syntax.