Print the output with different file names


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print the output with different file names
# 1  
Old 03-03-2016
Print the output with different file names

I have a python script that gives output called test.png. By using the following command I run the script every 2 seconds. What is the easiest way to save the output as follows ( test.png (1st output), tes1.png (second output), tes2.png ....)

Command I i use

Code:
while sleep 2; do python script1.py; done

script1.py

Code:
import sys
from PyQt4.QtGui import QPixmap, QApplication
app = QApplication(sys.argv)
QPixmap.grabWindow(QApplication.desktop().winId()).save('test.png', 'png')

# 2  
Old 03-03-2016
Got bash? Try
Code:
while sleep 2; do python script1.py $((++CNT)); done

and deploy the argument within script1.py.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to list files names and sizes in a directory and output result to the file?

Hi , I'm trying to list the files and output is written to a file. But when I execute the command , the output file is being listed. How to exclude it ? /tmp file1.txt file2.txt ls -ltr |grep -v '-' | awk print {$9, $5} > output.txt cat output.txt file1.txt file2.txt output.txt (8 Replies)
Discussion started by: etldeveloper
8 Replies

2. Shell Programming and Scripting

Finding a string in a list of files, print file names

I'm interested in writing a report script using BASH that searches all of the files in a particular directory for a keyword and printing a list of files containing this string... In fact this reporting script would have searches for multiple keywords, so I'm interested in making multiple... (2 Replies)
Discussion started by: chemscripter904
2 Replies

3. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

4. UNIX for Advanced & Expert Users

Find 2 occurrences of a word and print file names

I was thinking something like this but it always gets rid of the file location. grep -roh base. | wc -l find . -type f -exec grep -o base {} \; | wc -l Would this be a job for awk? Would I need to store the file locations in an array? (3 Replies)
Discussion started by: cokedude
3 Replies

5. Shell Programming and Scripting

Print file names in a loop

OS : RHEL 6.1 Shell : Bash I have lots of files in /tmp/stage directory as show below. Using a loop, I need to print all the filenames in this directory except those ending with a number. How can I do this ? # pwd /tmp/stage # # # ls -l * -rw-r--r--. 1 root root 0 Oct 7 18:38 stmt1... (2 Replies)
Discussion started by: kraljic
2 Replies

6. Shell Programming and Scripting

wget output file names

Hi, I have a list of urls in my input.txt file like this input.txt http://unix.com/index.html?acc=OSR765454&file=filename1.gz http://unix.com/index.html?acc=OBR765454&file=filename111.gz http://unix.com/index.html?acc=ORS765454&file=filename1111.gz... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

7. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

8. Shell Programming and Scripting

Print numbers along with file names.

Hi All, I have some thousand files with names like 1.syl, 2.syl, 5.syl etc. These files contain one sentence each. I want to store all those sentences along with the file ID that is 1, 2, 5 with the sentences they contain. For example, 1.syl has this is a test line 2.syl has ... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

9. Shell Programming and Scripting

[Urgent]how to print the file names into a txt file???

HI, I have a folder with some 120 files...i just want to print all the file filenames(not the content or anything else) onto a file say .txt. please help me with this command Thanks a lot. (15 Replies)
Discussion started by: kumarsaravana_s
15 Replies

10. UNIX for Dummies Questions & Answers

Need to print file names in a certain date range using ls

I need to list only file names of a specific date from the command ls -lt. :confused: (2 Replies)
Discussion started by: Shamwari
2 Replies
Login or Register to Ask a Question