Skip to content

Search and Replace under linux?

I tried the following but not adding ” this example I want to replace FILENAME_LOGIN to ‘login.php’ Tried this: However, it gives me login.php not ‘login.php’ Thanks Answer You only need sed for this:

not able to redirect the output to a file in ipython ide

I am not able to redirect the output of dir(modulename) to a file in ipython ide. Please let me know how to do that. It works for the same for ls and other linux commands. Answer You are mixing two worlds here. One is the Python world in which you can call Python functions (like dir()); in this world redirect…

empty an existing array in ksh

I have script which stores the list of files in an array as shown below I have to empty this my_array variable to use it for other purpose. I cannot declare another new array. Is there any way to clear the content of the array and reuse it again? Thanks in advance. Answer Since you’re already using set …

[ Python 2.7 ]Package program with Pynsist

I am packaging a Python 2.7 program with the lastest version of Pynsist. I’ve created an installer.cfg file following this example. But when I try to package my application running into the application folder it comes up with So the problem I think is with Pygame. On Google there in nothing about this, …

Shell script to edit and add a entry in file

Could any one help me to add entry at the end of the line. This is linux os. Below is the contents of the file /boot/grub2/grub.cfg I need to add entry at the end of the line “text1” and “text2”. after edit my file should look like: Answer With sed expression:

Listing files with numeric names

How do I list files that have only numeric names e.g I have tried ls -l [0-9]* but this seems to bring all file names that start with a digit and can have anything in their name after a digit. Answer First, turn on Bash’s extglob option: Then use this pattern: Read more about extended pattern matching i…

Shell param doesn’t pass with command

I use the following code to execute shell command, the issue is that when I put it as parameter which I should get from user it doesn’t work but If I put it hard-coded it works. Working Not working In the not working version which I do cat to param I see the value printed OK, what could I miss