I have two files. file.txt and delete.txt file.txt contains the following for ex.: delete.txt contains: I need to delete the rows from file.txt that are contained within delete.txt cat file.txt should result with: So far I’ve tried this with no luck: I don’t receive any error, it just doesn’…
Update python on linux 2.7 to 3.5
So I updated python using these instructions: then then and it worked but when I closed terminal, and wrote python -v it is still python 2.7 and still getting errors executing code that use v3+ standard libraries How to make it working as 3.5? Answer You still have Python 2 installed, and the python command i…
Sort a find command to respect a custom order in Unix
I have a script that outputs file paths (via find), which I want to sort based on very specific custom logic: 1st sort key: I want the 2nd and, if present, the 3rd –separated field to be sorted using custom ordering based on a list of keys I supply – but excluding a numerical suffix. With the samp…
optimize xargs argument enumeration
Can this usage of xargs argument enumaration be optimized better? The aim is to inject single argument in the middle of the actual command. I do: or I get: which is what I need but I wondered if loop and temporary variable could be avoided? Answer Try without xargs. For most situations xargs is overkill. Depe…
Bash Scripting: How to display output for the passwords expiry every 2 week
My question is, how do i edit the script such that if PASS_MAX_DAYS is equals to 14 days or less then it equals to “Vulnerability: No”? Output My Script Answer You can use grep -oP “^PASS_MAX_DAYSs+K([0-9]+)” /etc/login.defs to extract the value : K starts the match from the position o…
Bash Scripting: How to display output for checking root logins via SSH not allowed?
My question is, how do i make the script into a if else statement that it checks if “PermitRootLogin no”, it should display the “Vulnerability: No” and if the “PermitRootLogin yes” it should display as “Vulnerability: Yes”? Thanks in advance! Output Script Answe…
Linux expect command without interact directive not working
I want to login from 192.168.119.128 to 192.168.119.129 automatic and run some commands, so I write an expect script. a.sh The output is: I login successfuly, but it seems touch /tmp/a.txt command is not run. When I uncomment the last line #interact of a.sh, it works, and the file a.txt is created. Here is th…
Linux grep command to find the value of key from json
I have a JSON output that contains a list of objects stored in a variable.(I may not be phrasing that right) Output of a curl command: will post in comment as I am unable to post here I want to grep the value at this position “ad6743fae9c54748b8644564c691ba58” shown in the output, which changes ev…
Using sed with regex to replace text on OSX and Linux
I am trying to replace some strings inside a file with sed using Regular Expressions. To complicate the matter, this is being done inside a Makefile script that needs to work on both osx and linux. Specifically, within file.tex I want to replace with (xxx and yyy are just example text.) Note, xxx could contai…
OpenVPN multiple IP addresses [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …