vim 'n' lynx: command line option to search for string
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
vim 'n' lynx: command line option to search for string
Hi All!
I've looked at man and info pages, but can't figure out how to pass an argument to lynx and vim on the command line that will highlight all occurences of a given string. I'm thinking something like
vim --search-string=highlightme $foo.txt
lynx --search-string=highlightme $foo.html
Originally posted by martinman in vim you can search by typing "/ searchterm"
Yeah, sorry I should have mentioned that. I want to do it from the command line, because I have a lot of files to go through and a fetish for automating things
Originally posted by seabass55 have you tried grep?
Oh, I use grep lots, but it's not the same: for instance, in grep you can't tell whether something is a tab or a space, if you see what I mean... grep is really good for predictable situations, e.g. where you know exactly how many context lines you will need, but you won't always have that prior information.
Oh, I use grep lots, but it's not the same: for instance, in grep you can't tell whether something is a tab or a space, if you see what I mean... grep is really good for predictable situations, e.g. where you know exactly how many context lines you will need, but you won't always have that prior information.
Thanks anyway,
Samsara
Hey, this might be old or what-not, but I figured I would reply anyhow for Googlers.
Yes, you can do this. Start by outputting the source code with lynx and then we can strip the characters from there with sed and a simple regex. For example, to get your ip address from http://ipaddress.com:
Code:
lynx http://ipaddress.com -source | grep 'My IP Address' | tail -n1 | sed 's/<[^>]*>//g'
output source code from ipaddress.com | search for 'My IP Address' | print out last line | strip <html> tags
Further stripping of text can happen afterwards. Just check for "sed find and replace" in Google and pipe the output to the command. If you need something more complex after that, I would actually recommend using a scripting language.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.