Quantcast
Channel: Sed is dumping the entire file - Ask Ubuntu
Viewing all articles
Browse latest Browse all 4

Answer by S. Nixon for Sed is dumping the entire file

$
0
0

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 singles out only lines that contain the href. The tr converts spaces to newlines. The second grep grabs just the href section you were interested in. Finally, the cut grabs everything after the "href=".


Viewing all articles
Browse latest Browse all 4

Trending Articles