Sponsored Content
Top Forums Shell Programming and Scripting Print the output with different file names Post 302968065 by quincyjones on Thursday 3rd of March 2016 10:42:10 AM
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')

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
ARRAYOBJECT.NATCASESORT(3)						 1						ARRAYOBJECT.NATCASESORT(3)

ArrayObject::natcasesort - Sort an array using a case insensitive "natural order" algorithm

SYNOPSIS
public void ArrayObject::natcasesort (void ) DESCRIPTION
This method is a case insensitive version of ArrayObject::natsort. This method implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value asso- ciations. This is described as a "natural ordering". PARAMETERS
This function has no parameters. RETURN VALUES
No value is returned. EXAMPLES
Example #1 ArrayObject.natcasesort(3) example <?php $array = array('IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png'); $arr1 = new ArrayObject($array); $arr2 = clone $arr1; $arr1->asort(); echo "Standard sorting "; print_r($arr1); $arr2->natcasesort(); echo " Natural order sorting (case-insensitive) "; print_r($arr2); ?> The above example will output: Standard sorting ArrayObject Object ( [0] => IMG0.png [5] => IMG3.png [4] => img1.png [2] => img10.png [1] => img12.png [3] => img2.png ) Natural order sorting (case-insensitive) ArrayObject Object ( [0] => IMG0.png [4] => img1.png [3] => img2.png [5] => IMG3.png [2] => img10.png [1] => img12.png ) For more information see: Martin Pool's Natural Order String Comparison page. SEE ALSO
ArrayObject::asort, ArrayObject::ksort, ArrayObject::natsort, ArrayObject::uasort, ArrayObject::uksort. PHP Documentation Group ARRAYOBJECT.NATCASESORT(3)
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy