I have a flat file with a list of URL's I want to spider. I only want to check the ones of a certain length though. I am unaware of any way to cut the shorter urls from the list via bash. Would it be possible to create a simple for do loop to remove lines in the file that contain less than 5 forward slashed? "/"
Asked
Active
Viewed 49 times
-1
-
Use `grep` to select all lines not matching a patterm with at least 5 slashes. – Jim Garrison Jul 12 '16 at 20:38
-
You can use this to count your `/`s in bash: http://stackoverflow.com/a/16679640/1716866. – leekaiinthesky Jul 12 '16 at 20:44
2 Answers
0
You can simply to:
grep '://.*/.*/.*/.*/.*/' urls.txt
This will only match lines that have at least 5 slashes.

Will
- 24,082
- 14
- 97
- 108
0
Use
grep '//.*/.*/.*/' filename

Jim Garrison
- 85,615
- 20
- 155
- 190
-
Please edit with more information. Code-only and "try this" answers are discouraged, because they contain no searchable content, and don't explain why someone should "try this". We make an effort here to be a resource for knowledge. – abarisone Jul 13 '16 at 08:49