Caucasian Malaysian
Caucasian Malaysian

Reputation: 345

How to remove numbering from "lynx --dump -listonly"

$ lynx --dump -listonly index.html

Example result:

References

Visible links
1. http://lynx.invisible-island.net/
2. http://lynx.invisible-island.net/lynx.html
3. http://lynx.invisible-island.net/current/index.html

What I want to do is remove the 1. 2. and 3. "References" and "Visible Links" text included.

Wanted Result:

http://lynx.invisible-island.net/
http://lynx.invisible-island.net/lynx.html
http://lynx.invisible-island.net/current/index.html

Upvotes: 5

Views: 2800

Answers (3)

poboxy
poboxy

Reputation: 170

You can use -nonumbers option of Lynx

lynx --dump -nonumbers -listonly http://lynx.invisible-island.net/

Upvotes: 16

kyodev
kyodev

Reputation: 583

I have this input, with spaces on top of each line:

 1. http://lynx.invisible-island.net/
 2. http://lynx.invisible-island.net/lynx.html

then, with the suppression of lines 1 to 3:

lynx --dump -listonly http://lynx.invisible-island.net/ | sed -E 's/^ ?+[0-9]+\. //; 1,3d'

output

http://lynx.invisible-island.net/
http://lynx.invisible-island.net/lynx.html

Upvotes: 0

Tripp Kinetics
Tripp Kinetics

Reputation: 5449

Try:

lynx --dump -listonly index.html | sed -r 's/^[0-9]+\. //'

Upvotes: 0

Related Questions