Skip to content

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…

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 …