I have a file contains numbers. 1 34 44 44 46 5 35 40 40 45 6 36 28 30 40 My goal is for each column to have the absolute value after subtracting the following value by the previous one as the below: 1 34 44 44 46 4 1 4 4 1 1 1 12 10 5 I
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
Script in ubuntu to take CPU temperature and CPU usage in the same time and save to file [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. Improve this question I need to write script or command line code in Ubuntu which take CPU temperature and % of CPU usage from lm_sensors or something similar
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
Linux how to remove files in one folder where prefixes don’t match another folder?
I want to remove extra files in one folder where the prefix file names don’t match those in the other. A simple example will show: From folderA I want to remove frame0002.jpg and frame0006.jpg because those frameXXXX prefixes don’t exist in folderB. How can I do this automatically in 1 command line statement? Assume that the frameXXXX format will be
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
Is there a way to retrieve the script path called by a user-defined command?
I’m a newbie in GNU/Linux and, for a project, I need to do some reverse engineering. At a given line in a script, there is a command: I’m almost sure the “dc” command was previously added to the path/simlink/(?) by a previous developper. When executed, the command allows to run a simulation over the case indicated by the PATH. Yet,