![]() He took the name from the ed command string g/re/p, which translates as "global regular expression search. Thompson spent about an hour that evening making his tool a general utility that could be used by others and renamed it as grep. He needed a tool that could search for phrases and strings within text files. McMahon was trying to identify the authors of the Federalist papers through textual analysis. As you can see in the man page, option -u stands for 'unique', -t for the field delimiter, and -k allows you to select the location (key). His department head at Bell Labs, Doug Mcilroy, approached Thompson and described the problem one of his colleagues, Lee McMahon, was facing. You can use simply the options provided by the sort command: sort -u -t, -k4,4 file.csv. Ken Thompson had extracted the regular expression search capabilities from the ed editor ( pronounced ee-dee) and created a little program - for his own use - to search through text files. If the document is complex or if youre using this in a script that will survive months or years and not just a one-off job, you may end up feeling sorry for the results. For a very simple scenario, you can get it working. The first two are bang on the third is slightly off. The problem with grep here is that its a generic tool for text processing and its not aware of any XML structure. ![]() Thirdly, it was written overnight to satisfy a particular need. Secondly, the wealth of options can be overwhelming. The grep command is famous in Linux and Unix circles for three reasons. It also works with piped output from other commands. ![]() The Linux grep command is a string and pattern matching utility that displays matching lines from multiple files. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |