Skip to content
Advertisement

Tag: command

BASH: Filter list of files by return value of another command

I have series of directories with (mostly) video files in them, say I create a variable (video_dir) with the directory names (based on other parameters) and use that with find to generate the basic list. I then filter based on another variable (video_type) for file types (because there is sometimes non-video files in the dirs) piping it through egrep. Then

How to list filenames containing a specific string

I’ve been searching for commands that would print the list of filenames that contain a specific string, regardless if the string is part of a bigger string. So for instance, say there’s a directory with files “DABC.txt”, “ABC.txt”, “ABC”, and “CDA.txt”. Then if I want to search for all filenames that contain the word “ABC”, the command I’m looking for

Terminal hangs when executing yum commands

During a patch window, the yum update command stopped running with a Bus Error. Now when I try to execute a yum command my terminal hangs and I need to kill the process. I have tried to kill all the yum commands running that showed with the ps -aef | grep yum, this did not help. I have tried to

Using sed with regex to match varying lines

I’m having some issues used sed to match a regex pattern. An example would be with the following lines: spring-core-4.0.0 should be spring-core-4.1.0 spring-web-4.0.0 should be spring-web-4.1.0 I want the regex to match any characters in between spring and the version number. I’m not sure if I need to do something else for sed to remember what those characters are

grep -v with while read line command not working properly

I use this command to remove lines from (target.txt) that match string in (removefrom.txt) This is (target.txt) This is (removefrom.txt) This is the result should look like: But sometimes the resule is like: or or I ever try to use sed, but the problem is still there, It didn’t remove lines properly. Answer grep -vf removefrom.txt target.txt

Sending linux commands in Perl – Grep piped to grep

The basic code: Why wont Perl complete these commands correctly? $fail2ban is already defined to 0, so that’s not the issue. The fail2ban.log does contain a line that should match(when running command from shell it matches): The error i keep getting is: All the commands run fine from bash/shell, seems at if perl is not happy with grep being piped

Advertisement