You are not logged in.
Oh Lord, why it's not working, just empty string
Offline
It's all okay
Obviously not…
grep data-track-url test.txtOnline
It's all okay
Obviously not…
grep data-track-url test.txt
Yes the grep has returned me a lot of html to the my console
Offline
sed -e '/data-track-url/!d' test.txtOnline
sed -e '/data-track-url/!d' test.txt
Yes that's also shown many HTML strings
Offline
sed -e '/data-track-url=/!d' test.txt
sed -e '/data-track-url="/!d' test.txtAh, fuck… again.
sed -e '/data-track-url=/!d; s/.*data-track-url="\([^"]*\)".*/\1/g' test.txtOnline
sed -e '/data-track-url=/!d' test.txt sed -e '/data-track-url="/!d' test.txtAh, fuck… again.
sed -e '/data-track-url=/!d; s/.*data-track-url="\([^"]*\)".*/\1/g' test.txtI not wont wite but it's also not working
Like this has return me all page in console:
sed -e '/data-track-url/!d; s/.*data-track-url="\([^"]*\)".*/\1/g' test.txt
Offline
The
sed -e '/data-track-url/!d; s/.*data-track-url\([^"]*\)".*/\1/g' test.txtReturns to me:
</span>=%Offline
Please don't go a way. I really did't get why it not working at all.
Offline
After reinstalling arch all working... thanks to zhs...
Offline
Sed is the wrong tool for the job. This sed command will get you at most one desired url from every line that has a data-track-url:
sed -n '/data-track-url/{s/.*data-track-url="\([^"]*\)".*/\1/p;}' test.txtBut if there is more than one data-track-url per line (which thre appears to be) this will fail. The previously attempted use of the 'g' flag for sed will not remedy this.
In this case, piping grep to cut might be the way to go:
grep -o 'data-track-url="[^"]*"' test.txt | cut -d\" -f 2Last edited by Trilby (2020-12-12 02:30:35)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Ashley, sed is not very good for what you are trying to do, if this is html or xml.
I do not know of ZHS, is this server related?
A dog is a man's best friend.
Offline
Ashley, sed is not very good for what you are trying to do, if this is html or xml.
I do not know of ZHS, is this server related?
![]()
Offline
Sed is the wrong tool for the job. This sed command will get you at most one desired url from every line that has a data-track-url:
sed -n '/data-track-url/{s/.*data-track-url="\([^"]*\)".*/\1/p;}' test.txtBut if there is more than one data-track-url per line (which thre appears to be) this will fail. The previously attempted use of the 'g' flag for sed will not remedy this.
In this case, piping grep to cut might be the way to go:
grep -o 'data-track-url="[^"]*"' test.txt | cut -d\" -f 2
Hey do I can this one?
cat * | grep -o 'data-track-url="[^"]*"' test.txt | cut -d\" -f 2Offline
Ah ... have you never used a linux/unix system before? The example was acting on test.txt, if you want it to run on all files (in the current working directory) you replace "test.txt" with the asterisk
grep -o 'data-track-url="[^"]*"' * | cut -d\" -f 2(edit: did you just change your avatar? Great, now I'm not the only one with a creepy forum stalker).
Last edited by Trilby (2020-12-12 14:08:42)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline