 Hello and welcome to this video by filmsbychrist.com, I'm Chris and today we're going to be looking at a few things, but we're also going to be looking at FZF, it's a fuzzy finder application. It is an amazing program, once you have it installed you're not going to want to live without it and it's very easy to install. I'm running Debi and Sid and at the current time that's in the repositories, I'm not sure if it's in the repositories for Debi and stable yet, at least last I checked it wasn't, but it was a little while ago since I checked. So you might be able to do apt install to install it, apt install FZF and if not it's super easy to install. Otherwise you can come down here at installation, it has a few options, you can say using git and here you just, once you have git installed, you say you clone it and then you run the install command and there's also plugins for Vim which are also very useful, but what does it do? It's a fuzzy finder, so basically when you type something, you want to search through something, you can start typing and it's, think of it as like grep, although with very large files grep might be a little faster but not as smart because grep will look for exactly what you're typing in there, but this will search through it while you're typing and kind of tries to be smart about it. So for example, I have a file here called people.csv, I'll try to remember, put a link to this in the description, it's a test file that I created based on real people and real addresses, although I shuffle everything up so they don't really match, so I don't have people's information just in there, but it's a good large file, you can see here if I actually wc-l, wc counts the lines, words and characters in a file, but if you do dash l it'll just give you the lines, so let me do that and give it that file people.csv, it is going to say there's 862 entries in here, so not a enormous file but a large enough file and of course if I want to I can say grep find everyone with the name John which will again include John, Johnson, let's put quotations around this just because I like to and we'll say people.csv and it will show you all the lines with the word John as we got Johnson here, John here, John here, John here, Johnson up here, all in order, how many people did we get? We got word count dash l, so 24 entries with the word John in it, so that was nice, so we can then narrow it down after that, let's say I wanted to find okay the ones that live in Hawthorne, so I can now go ahead and say grep this, but then I can also pipe that and actually you could probably do this all on grep, but I'm gonna pipe the output of that into another grep command and just say find Hawthorne which is great, it's doing it super fast but it's looking for those specific things, we narrow it down to four, we got two Johns and two Johnsons that live in Hawthorne and but you know we had to type out the commands and then see what comes up. If I want to have fzf installed, I'm gonna do fzf, actually we're gonna do cat, the name of that file, so people.csv which is a plain text file, csv just means that we have columns, think of it like a spreadsheet but the spreadsheet cells are divided by the commas in the file, so you'll see that each column has it and you can open it up with a spreadsheet program, so for example before we get to fzf let me just say Libre, LibreOffice and I should be able to give it that file and what's gonna do is gonna open up that file and it's going to say hey how do you want this, this is set to tabs because that's the last file, I'm gonna say I want commas right there comma and now you can see I found all the commas and if I click okay I now have a spreadsheet with the columns based on those commas, so that is how a csv file although you don't have to use commas usually when I create a file I'll use a character like a pipe symbol that's less commonly because an address might have a comma and in which case you have to work with quotation marks and whatnot but anyway just wanted to show you a csv file can be viewed that way and edited that way and then export again a csv file which is again just a plain text file but going back to what we were about to do people that csv I can pipe that into fzf and now I type that and now if I type in John it starts narrowing down the list of type and if I make mistake I can go back and again now I don't even have to hit space I can just type in HAW and you can see it's now look for lines with that might have something like that in there doesn't just look for HAW it's looking for things that have been found exact matches for John but up here it says oh it has an H and a and a W but it puts the best match down here at the bottom and you can also say it to reverse so that so it's the lists is the other way where the top is the best match but by default it's like this at the bottom and so yeah and now I can use arrows to choose which one I want and when I hit enter it's just going to output that information so what I can do now is okay that's all I'm online let's just make it a little bit easier to read so I'll just pipe that into the TR command so what a TR command do let's talk about that real quick again this is just an overview of command I'm just showing you a bunch of commands I've done tutorials on all these in the past in more depth except for FCS I haven't really done a tutorial on that yet I've demoed it before but as you can see it's pretty simple to use but if I was to echo something like Chris comma Smith comma Naples obviously I get that output if I pipe that into TR I can now replace individual characters so here I can say I want to replace all commas with the pipe character and there you go it prints it out with the pipe characters instead of the commas if I wanted to change all the commas to dashes I can do that I can also do special things like backslash and now says find all the commas and change those commas into new lines and again this is not modifying any files or anything it's just modifying the output so now I have each one of those entries on new line and that's exactly what we're gonna do with our fuzzy finder here so I'll go back up to this let's clear the screen so again if I was to type this command and I was to type in Chris and I'll say Gainesville we have a Kristen that white oak strife in Gainesville I'll hit enter that's the output but if I was now pipe that into TR and say change all these commas to new lines now when I type in we'll say Jack and we'll say Jack from High Springs so I'll start typing Springs look I even narrowed it down to the final one I'll hit enter and now because we used TR instead of printing all one line I have each comma new line which might be a better way to print it I do have empty lines here which you could also you know delete using said again I guess I can show you that we should be able to do something like said and we'll say carrot dollar sign I'm pretty sure this is how you do that we'll see I'll just pick a name from here boom there we go we got rid of it so basically this said command here said again I have videos going more in depth said allows you to manipulate text in so many different ways in fact I can probably get rid of this TR command and use a single said command to replace that if I want instead of doing TR and then said but in this case I'm saying said and I'm saying find all lines so the carrot symbol is a special character saying the first the beginning of a line and the dollar sign is the end of the line so since I'm doing that with nothing in between saying find empty lines and then the forward slash D means delete it so basically if it's a blank line delete it and we have these blank lines because if I cat out to my people dot CSV you can see each one of these lines has a few extra columns here most of them some of them have some information in there but most of them have like three or so extra commas at the end which are blank cells and that's why we're getting those blank lines but our said command here after I type something like Terry and we'll say in whoops Terry yeah we'll just pick one of these I'm just coming up with random stuff so again we're we're catting out the entire file putting that in the fuzzy finder which at what point we're typing for what we're looking for when we find what we're looking for we hit enter and it puts that in the TR replacing all the commas with new line characters so putting each column each cell on its own line just to make it easier to read and then we're saying okay find every blank line and delete that so we don't have those trailing blank lines so again if we remove that said command and I just pick a name here and hit enter you can see we have these extra lines down here at the bottom we don't necessarily want so anyway that's a quick look at what do we go over today again I'm just doing quick overviews catting out the entire file we already went over but using fuzzy finder FZF and we're using the TR command to replace individual characters so again we can do something like instead of even using commas I can say replace all capital T's with capital B's and if I was to now type in Terry again Terry again and choose a name it should change that to Barry so and it did see so TR is really great about it's very a very simple command for replacing individual characters with other individual characters or if you replacing words and said what could also do that but said is also a lot more in depth can replace entire words or other types of combinations so yeah so TR does that and then said I just showed you one basic command here which just deletes blank lines said does so much that you know I've been using it for years and I only touched the surface of it because it's basically a complete word processor you know for manipulating everything without actually opening up the file it is amazing so yeah I'll try to put a link in the description of the video actually let me get that link for you right now so yeah there it is it is filmsitechris.com forward slash scripts forward slash my notes capital M capital N notes and then people dot CSV and that's just a file I generated from voters records but like scrambling the names and addresses and stuff so it's realistic data without being real data that you can use for testing purposes and has close to a thousand was 860 some people in there and yeah get that I'll try to put a link in the description but just in case I forget or you're watching this somewhere where there isn't a description box that is the link right there to this test file yeah I thank you for watching and again I'm going over these things real fast just giving you an overview of them go to films by chris.com that's Chris the K there's a link into the description and there you can search through actually let's just go there real quick and what we can do here when you load up the page under the videos section you can just start something typing something like grep and it'll bring up grep videos you can start typing said and it should bring up some said videos and you can type in do I have a video on TR that's gonna bring up a lot of stuff because probably a lot of stuff with the letters TR in it but yeah check out my videos I literally have thousands of videos I've been doing this for over a decade and I do thank you for watching think about supporting under the support section you can support me through patreon or do a donation through PayPal and also my website and videos are completely searchable if you were to use a shell application such as links curl or W get just check out the instructions here or if you just try to W get or curl my website films at chris.com it should bring up instructions and examples for shell shell searching thanks for watching and as always I hope that you have a great day