Provide text output for none-block selection mode
mailsanchu opened this issue · 13 comments
No description provided, so I have to guess what you meant.
$ cat /tmp/cascadia.xml | cascadia -i -o -c 'div' --piece SelText='p'
SelText
Name: John Doe
You meant this SelText
?
You can change it to whatever you want:
$ cat /tmp/cascadia.xml | cascadia -i -o -c 'div' --piece I_Want='p'
I_Want
Name: John Doe
Or remove it completely with the help of other tools like sed
.
The cascadia
is a *nix tool and it is built with the Unix philosophy, which emphasizes building simple, short, clear, modular, and extensible code that can be easily maintained and repurposed by developers other than its creators. The Unix philosophy favors composability as opposed to monolithic design.
To remove it completely with sed
:
$ cat /tmp/cascadia.xml | cascadia -i -o -c 'div' --piece SelText='p' | sed '1d'
Name: John Doe
HTH
I meant Or remove it completely
I wanted to find the release version for this Github page
https://github.com/puppeteer/puppeteer/releases
But you gave me the answer I want.
Thank you Thank you
My final version for the future visitors of this page
cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -c "div[class='flex-1']" --piece SelText='h1' | grep -E --color=none '[v0-9.]'
OK, re-title it to "Provide text output for none-block selection mode"
Basically the ask is to get the text part from this output:
$ cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -c "div[class='flex-1'] h1"
<h1 data-view-component="true" class="d-inline mr-3">v11.0.0</h1>
Yes the above comment is correct ^^
I think we can close this ticket. I gave a fully working example.ANother one give below as well
cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -c "div[class='flex-1'] h1" | xpath -q -e "//h1/text()"
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "div[class='flex-1'] h1"
<h1 data-view-component="true" class="d-inline mr-3">v1.2.6</h1>
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "div[class='flex-1'] h1" -t
v1.2.6
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "div.flex-1 h1" -t
v1.2.6
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "h1.d-inline.mr-3" -t
v1.2.6
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "div.flex-1 h1" -t | hexdump -C
00000000 76 31 2e 32 2e 36 09 0a 0a |v1.2.6...|
$ cascadia -q -i "https://github.com/suntong/cascadia/releases/latest" -o -c "div.flex-1 h1" -t -d '' | hexdump -C
00000000 76 31 2e 32 2e 36 0a 0a |v1.2.6..|
$ cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -c "div[class='flex-1']" -t -R; echo done
12.0.0
Latest
This commit was created on GitHub.com and signed with GitHub’s verified signature.
done
$ cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -c "div[class='flex-1']" -t; echo done
12.0.0
Latest
This commit was created on GitHub.com and signed with GitHub’s verified signature.
done
$ cascadia -q -i "https://github.com/puppeteer/puppeteer/releases/latest" -o -t -c "h1.d-inline.mr-3" -c "div.flex-1 strong"
12.0.0
verified signature
Super cool
can you give me a minimum case to duplicate, not just a screenshot please.
-t
will grab everything as a single output, and trimming will only happen to its leading and trailing white space of that massive text, not each line.
:) Hmm that is why my grep was not working