Tag Info

Hot answers tagged

7

You can use a cut command. To extract the second pattern: echo "blah@foobar1@blah" | cut -f2 -d"@" To extract the second and third patterns: echo "blah@foobar1@blah" | cut -f2,3 -d"@" To extract from the second pattern onwards echo "blah@foobar1@blah" | cut -f2- -d"@" EDIT: Since the question was tagged with awk. Here is an awk solution. echo ...


2

Ok, I've found what was missing. Here you can find in one answer, that in all the requirements are actually these ones: sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev python3-pip After that, you can safely do sudo pip install lxml


2

There is just a single change between two code snippets, the first one uses: count = count + keywords[key] while the second one uses: count = count + key In case of the first one you are taking the value of a key of the dictionary and then adding the value to the previous count. While in the second case you are adding the key (string) itself to the ...


1

The "Python.h" error message indicates that you are missing the python3-devpackage, which you need to build any Python extensions (Python modules written in C), which you can get with: apt-get install python3-dev To get up and running from scratch: apt-get update && apt-get install python3-dev python3-pip build-essential libzmq3-dev pip3 install ...


1

Using sed echo "blahŤfoobar1Ťblah" | sed -e 's/\(^.*Ť\)\(.*\)\(Ť.*$\)/\2/' output foobar1 Another possible way using sed echo "blahŤfoobar1Ťblah" | sed 's/.*Ť\(.*\)Ť.*/\1/' output foobar1


1

Using bash : $ test='blahŤfoobar1Ťblah' $ spamegg="${test#*Ť}" $ echo "${spamegg%Ť*}" foobar1 Here we have used the bash parameter expansion get the desired substring. "${test#*Ť}" will remove the portion blahŤ , so the variable spamegg will have foobar1Ťblah ${spamegg%Ť*} will remove the trailing Ťblah, so we would get the output foobar1 Using grep : ...


1

awk seems to be the easiest to use for this problem: $ echo "blahŤfoobar1Ťblah" | awk -FŤ '{ print $2 }' foobar1


1

Ubuntu has Python 2.7 set as default. So, running python or pip normally runs the 2.7 version. If you want to run version 3 then you have to use the command python3 and pip3 pip3 -V python3 -V For the virtual envirmoment if found the command pyvenv-3.4 pyvenv-3.4 myenv_folder #Creates a python 3.4 virtual enviroment in the myenv_folder cd myenv_folder ...


1

You could use the Gtk.TreeSelection.set_select_function functionality for this. Basically you give it a function, each time a row is selected this function is called. When it returns False the row can't be selected. Here's an example: treeview = builder.get_object("treeview3") selection = treeview.get_selection() selection.set_select_function(_select_func, ...



Only top voted, non community-wiki answers of a minimum length are eligible