So far I have this: I’m not quite sure how to use wc to find out the exact number of files. When using the command above, all the .txt files show up, but I need the exact number of files with the .txt extension. Please don’t suggest using other commands as I’d like to specifically use find and wc. Thanks
Tag: find
How to find all files containing specific text (which includes a backslash)?
I thought I found the perfect answer with How do I find all files containing specific text on Linux?, so I tried it: None show, but I know there should have been a match. I also tried escaping the backslash to no avail. Also tried single quotes to no avail. How to find all files containing specific text which includes
Better way of using the redirection symbol in conjunction with find -exec
My goal is to empty every file in a directory. I DON’T want to actually delete the file, I just want to delete it’s contents. If you want to do this with a single file you can do > file.txt If I want to run this operation on every file in a directory I can do this: Notice how the
Run find command from a bash file
Hi people: I’m making a xfe script to take a given directory as source file, use zenity to get output dir and perform some operations, for example: When the script is invoked, oggenc is not executed…any ideas? Solution: Based on answers bellow, this works as expected: Answer To make the variable $OUTPUT_DIR available to the child process, add one line:
find command not printing files with .wav extension as specified
I’ve tried using this command to recursively search a folder and print .wav files, showing only the file names (not the location): I’ve also tried putting .wav in double quotes like so: When I check the Wav_files.txt file there are also .xml files listed. I only intend to print the .wav files- What have I done wrong? Answer Put the
searching a file in linux
I want to find in the system a file, and I know part name of it. How could I do that? I tried unsuccessfully the command: The problem is probably very easy however I cannot find a decent tutorial on searching files in linux. Please tell me what command solves my problem and if you know a good tutorial so
Recursively grep unique pattern in different files
Sorry title is not very clear. So let’s say I’m grepping recursively for urls like this: grep -ERo ‘(http|https)://[^/”]+’ /folder and in folder there are several files containing the same url. My goal is to output only once this url. I tried to pipe the grep to | uniq or sort -u but that doesn’t help example result: Answer If
Find command with size and time and sorted by timestamp
I have the following folder setup for example I need to recursively list them with file size, modification time and sorted by modification time recent first. I have tried the below without size… Any pointers? Answer %T+ – modification time (and date) %s – size %p – path of file
Newbie-ish error: cp: omitting directory
Pulling my hair as I’m stuck with a basic error without understanding why: We’re in a “test” directory, in which I created one “del” subdirectory. The “test” directory contains a variety of files of various types. The result is a series of lines (same number as the number of files present in the directory from where the command is ran)
Get list of files that contain given text within directory given by pattern
I want to get a list of files that contain a given text within my file-system. Furthermore only files should be considdered that are located in a directoy given by a pattern. So let´s say I have a number of directories called myDir within my filelsystem as shown here: Now I want to get all the files within those directories