| User: editor -- 2011-07-18 << 821 823 >> |
| Hits: 292 |
| Type: Text file parser |
| Search all Text file parser examples |
| Description: |
| How to extract all records that contains specified field values? Given a file will many records, and a name list, how to extract all the records that contain these names? |
| Input Sample: |
| Records.txt name1 33 F name2 25 M name3 19 F name4 9 M ... Namelist: name1 name3 |
| Output Sample: |
| name1 33 F name3 19 F ... |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| 1. ctrl-o open record.txt 2. ctrl-h open 'replace' dialog * set 'replace unit' to 'Line' * set 'search for pattern' to nothing * set 'replace with pattern' to: * set 'if' to: * uncheck 'print unmatched unit' option 3. click 'replace', done. Note: you can change the list of 'name1', 'name3' in step2 base on your own need. |
Screenshot 1: Replace_Window |
Similar Examples: |
| How to extract all sentences that contain specified words? (79%) How to extract all blocks that contain specified strings like "A"? (74%) How to extract all lines that contain "abc" from multiple files? (68%) How to findout all lines that contain specified words in multiple files? (65%) How to extract all lines that contain words A and B and C? (65%) How to filter out all web pages that does not contain specified words? (63%) How to extract all lines that has no leading spaces? (62%) How to extract all characters within specified char set from a text file? (62%) |
Check Demo of Text file parser |
| Keywords: |
| given records field grep record names values unmatched unmatch print if contains extract file name search file with list set file list replace list file list many replace search file name |