Answer by pa4080 for Sed is dumping the entire file
That you've explaned sounds as the normal behaviour of sed used with the command substitution. I suppose you are looking for something like this: sed -nr 's/^.*href="(http.*)".*$/\1/p' index.html...
View ArticleAnswer by cmak.fr for Sed is dumping the entire file
you should use grep to find text in a file sed is better for text substitutions If you want to list the hypertext links, you can simply grep the file like this : grep -Po '(?<=href=")[^"]*' index.html
View ArticleAnswer by S. Nixon for Sed is dumping the entire file
This may be overly cumbersome, but I think it would work for you, as long as your href contents contains no spaces. grep "href" index.html |tr ' ' '\n'|grep "^href" |cut -f2 -d'=' The first grep...
View ArticleSed is dumping the entire file
I'm trying to parse contents of an HTML file to scrape a download directory, however I've modified it to a MWE that reproduces my issue: sed -e 's|\(href\)|\1|' index.html Prints the entirety of...
View Article