Assign a value
Hi,
I have a code html: Code:
...... How could I do this in bash? Many thanks and sorry for my english! |
We can't (usually) just 'write' your script for you....
Give it a try and submit what your script isn't quite doing correctly and folks will help you correct them. Happy New Year!! |
When submitting a portion of code to the forum, can you please enclose it in code tags [code*] [/code*] (without the *).
|
Quote:
Well, I do it, it's a solution tiresome but it works. I would like to do with sed but I couln't be capable. :-( I do: awk '/cajasinopsisabajo/{where=NR;print}NR==where+1 && where!=0 {print}' curl 1>h 2>/dev/null grep -v div h > h2 nawk '{sub(".*\">","")} {print}' h2 > h3 nawk '{sub("<\/.*","")} {print}' h3 > sinopsis Thanks! |
Using GNU sed
Code:
t1='<div class="cajasinopsisabajo">' This has made the sed expression more complicated. /$t1/,/$t4/ {/$t2/ addresses a line containing t2 which is in the range /$t1/,/$t4/. Lines are appended to the pattern space by N until t3 is found and deleted along with anything after it. Then t2 and anything before it are deleted and the pattern space printed. ba means 'goto label :a' (this creates a loop). tb means 'goto label :b if there's been a successful substitution in the s command' (this breaks out of the loop). |
All times are GMT -5. The time now is 10:12 AM. |