Friday, April 11, 2014

Re: Select entire line based on tag, then export only those lines of text

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

:g/pattern/d to delete lines matching pattern
:g!/pattern/d to delete lines not matching pattern so just do
:g!/\cambulance/d and then :w newfile to save the lines containing ambulance to newfile. The \c is for matching case insensitive.


Mart


On April 11, 2014 4:37:02 PM CEST, Greg Nevius <gnevius@gmail.com> wrote:
>Hello everyone! First off, let me say that I am a designer, and don't
>have the higher level of thinking required to do what I would like to
>accomplish. That being said, if anyone could help me, I would be so, so
>grateful and appreciative!
>
>Here's what I've got - a tab delimited text file ~1.6GB. It's a huge
>file.
>
>Step 1:
>What I need to do is search out anything that has the word "ambulance"
>and copy the entire line in VIM. Here's a example of l entry:
>
>1003006180 MEDICWEST AMBULANCE, INC. O 9 W DELHI AVE NORTH LAS
>VEGAS 890327836 NV US Ambulance Service Supplier Y F A0425 Ground
>mileage 73737.3 7873 12047 7.0418345939 0.8138691894 26.055025476 8.2428463203 5.5882732348 1.3276220145
>
>There are thousands of entries in the text file, so to manually search
>through is impossible.
>
>Step 2:
>I then need to extract these entries that contain "ambulance" (the
>entire line)and save all of them to another text file. From there, I
>can import into Excel.
>
>I had considered going the MySQL route, but that's shaky for me, being
>a pixel pusher :)
>
>Is this something that I can easily do in VIM? It seems like it's built
>for that.
>
>Once again, thank you very much for any time or assistance you may be
>able to provide!
>
>Cheers, G
>
>--
>--
>You received this message from the "vim_use" maillist.
>Do not top-post! Type your reply below the text you are replying to.
>For more information, visit http://www.vim.org/maillist.php
>
>---
>You received this message because you are subscribed to the Google
>Groups "vim_use" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to vim_use+unsubscribe@googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

- --
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQFBBAEBCgArBQJTSD3WJBxNYXJ0IEx1YmJlcnMgPG1hcnRAbWFydGx1YmJlcnMu
bmV0PgAKCRCpN7ehrT/r5zUSCACyO5CX/lOzA5sU4saC6/CRuj7tCQUy/azt8kgf
/KgLkUYvAg/3DBieOQ1P58p5XmUqFzf/kv5FiiOhFx/JLYoDPXRAIz3EGgHPZH+I
KDTCF5wfiaoaCWxPHgB4L4QPnf7zjkqLS8djOvk2v4iaHoJoZPB0RDBlt1JsVEHf
Nl+M7dB8mfftPR6DQO6JreIsLMGGCr5TP0JWPMLSje0T1v4CYJUMctH8T32sz976
HllFgSdcEDxPjmGWEoZNXxZzD6FQ20tb9qXtgX5lfZRyB3/Kk1Woij80h0MWI2JW
0mss//85Ms5rI2S38BVUHMcT0SH8mjvlkq8NvCOEzvYDKxKy
=EF5T
-----END PGP SIGNATURE-----

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: