I'm trying to make a program that will take a file, say my_test_file.log and make a new file called my_test_file.mdn. I'd like to be able to use this program by typing python renameprogram.py my_test_file.log into the command line. The original file will always end in .log.
3386
Is there a function to extract the extension from a filename?
3334
I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions?
36422
How to redirect standard output to multiple log files? The following does not work:  some_command 1&gt; output_log_1 output_log_2 2&gt;&amp;1
5312
I thought I heard that  was able to do this, but I never figured it out.  Has anyone successfully done this?  Can I see your setup.py file, and what command line options you used?  Basically I'm thinking of it giving me a single executable file that does something like unzips itself to maybe /temp and runs.
25958
I have a log file being written by another process which I want to watch for changes. Each time a change occurs I'd like to read the new data in to do some processing on it.  What's the best way to do this? I was hoping there'd be some sort of hook from the PyWin32 library. I've found the win32file.FindNextChangeNotification function but have no idea how to ask it to watch a specific file.  If anyone's done anything like this I'd be really grateful to hear how...  [Edit] I should have mentioned that I was after a solution that doesn't require polling.  [Edit] Curses! It seems this doesn't work over a mapped network drive. I'm guessing windows doesn't 'hear' any updates to the file the way it does on a local disk.
63109
Using the top command with redirection works fine:  top &gt; top.log   Now I want to use grep to filter a certain line:  top | grep "my_program" &gt; top.log   But the log file will remain empty. But grep delivers an output when using  top | grep "my_program"   Where my_program has to be replaced by a running program to see some output.  Why does my approach not work ? And how can I fix it ?
31639
I have an entire folder dedicated to python scripts.  I'm tired of doing chmod on every new python script that I write.  Is there a way to make every file inside my folder executable if it is a python script?  It would be nice to have a script that checks whenever a new .py script is created and if there is a new .py script make it executable right there on the spot.   I use Vim.
41402
This may be a simple question, but how do I use files starting with "-" with command line programs?   For example,  I am trying to use pdfgrep on a file named -2013-01-01.pdf but it complains that there are no options defined for 2, 0, 1, 3 and so on.  Changing the filename to something that does not start with "-" solves it, but this is not an option since the files aren't created by me. I simply want to check for a specific change I know is coming.
103911
I am working on a project that has a directory structure that looks a bit like this:  inputs/    a.txt    b.txt    c.txt  outputs/    a.out    b.out    c.out  makefile   The files in the outputs folder are generated from the files in the inputs folder and I want to automatically update them whenever one of the input files changes.  I tried to do this by creating a makefile with a pattern rule. (To keep this question simple, I'm just copying the input file instead of transforming it)  outputs/%.txt: inputs/%.out     cp $&lt; $@   However, this makefile didn't quite do what I want. If I run make outputs/a.txt it will apply the rule that I wrote and regenerate the output file if it is outdated but if I just run make then nothing happens:  make: *** No targets.  Stop.   Is there a way to tell make that by default I want to generate an output file for every file in the inputs folder?  edit: made the output files have a different file suffix than the input files.
46458
I have many files with .abc extension and want to change them to .edefg How to do this from command line ?  I have a root folder with many sub-folders, so the solution should work recursively.
106374
In gedit, printing a file gives an option of printing to file where the file can be saved as a pdf. How can I do the same thing from the command line?
33020
What is the easiest way to add a text to the beginning of another text file in Command Line (Windows)?
51237
I would like to drag and drop my data file onto a Python script and have it process the file and generate output. The Python script accepts the name of the data file as a command-line parameter, but Windows Explorer doesn't allow the script to be a drop target.  Is there some kind of configuration that needs to be done somewhere for this work?
44059
I have one input file and run some command but want the output to be saved with the same name as the input file has.  I tried below command but it makes the output file blank:  cat file1 | grep "YISHA" &gt; file1
109257
I realise this might be quite a simple question, but I'm still quite new to the command line and only have a grasp of basic commands.  I've downloaded some lecture presentations (~25 or so) from my University however on doing so they've been named things like...  L2%20Development%20of%20immune%20system.pptx L4%20Molecular%20Recognition.pdf   As you can see they've downloaded with the URL encoding %20 instead of a space.  My question is how to batch rename all of these files so that the %20 is removed and replaced with a space instead?
90839
For example, I edit and then run the same source.   vim arbit.py python arbit.py   I know I could run it from within vim, but I want a general solution on Bash. I keep finding situations where I reuse arguments.  How can I do that?
92707
i tried it the following way:  rename 'bla bla .txt' blabla.txt   But this doesn't work, what's the correct syntax for this case?