Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Run a program for every file with a given extension Post 302119818 by ghostdog74 on Friday 1st of June 2007 02:28:03 AM
Old 06-01-2007
you can find those files in Python itself. this way, you don't have to maintain an extra shell script.
some of the modules in Python you can use to find files are: os.walk(), glob , os.path.splitext() etc...

here's a snippet:
Code:
#!/usr/bin/python
import os
for root,dir,files in os.walk("/home"):
    for file in files:
        if file[-3:]==".lc":
            fullpath=os.path.join(root,file)
            do_something(fullpath)

however, if you want to use the shell to find those files, you can use "find" command
Code:
find /path -type f -name "*.lc" -print > file # or pipe to you python program

 

10 More Discussions You Might Find Interesting

1. Programming

how to run debugging on c program

Can someone help me debug a c program I am running? It gives me segmentation fault. I want to turn on debugging. Can some one give the command to turn it on? Below is the error I get: Segmentation Fault (core dumped) (3 Replies)
Discussion started by: ibeg
3 Replies

2. UNIX for Dummies Questions & Answers

Getting a program to run

Please help, I have tried to run this program countless times and still nothing. Please tell me what I'm doing wrong. $ cat>test count=1 while do echo "5" read number echo $5 let count=count+ 1 done exit 0 ^C$ ksh test $ ^C $ ksh test $ $ nothing happend (6 Replies)
Discussion started by: ctiamaria
6 Replies

3. Shell Programming and Scripting

how can i run java program from any where

Hello all sorry didnt know where to post it i compiled simple program that using "System.getProperty("user.dir");" now i compiled the program under directory foo and and its running great when i do "java myapp" i included this directory in the $PATH env variable so i could see it fro any where... (1 Reply)
Discussion started by: umen
1 Replies

4. UNIX for Dummies Questions & Answers

cannot run program

Hi, I have a program in /opt/local/bin, my path in my .profile is export PATH=/opt/local/bin:/opt/local/sbin:$PATH however when i type the program name it cannot find it, however i know the program is in /opt/local/bin? Thanks (2 Replies)
Discussion started by: c19h28O2
2 Replies

5. Shell Programming and Scripting

How to run this program with only one input file at a time

i have a program ABC, which runs every two minutes and takes the input according to the a value called "pointer" files need to be processed by ABC are input0001 input0002 input0003 input0004 input0005 current value of pointer is 0001, now program runs and takes all the files from... (2 Replies)
Discussion started by: Prat007
2 Replies

6. UNIX for Dummies Questions & Answers

Log in, run program

Hey, im editing the passwd file so that when the user ben logs in it runs my assign program. I changed the last column from to Then when i log in i get... There is no problem with the program because it runs fine when i open it normally. Any help much appreciated. (8 Replies)
Discussion started by: RAFC_99
8 Replies

7. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

8. UNIX for Advanced & Expert Users

Error compiling program with extension .c

good morning, I have 64-bit DB2 V9.7 AIX 7.1.0.0 I am compiling a C program, when running cc-I / rutadb2/include-c programa.c this error. ksh: cc: not found. how I can check if I have installed the C compiler? Any help will be greatly appreciated. Thank you very much and best regards. (2 Replies)
Discussion started by: systemoper
2 Replies

9. Shell Programming and Scripting

Run a program-print parameters to output file-replace op file contents with max 4th col

Hi Friends, This is the only solution to my task. So, any help is highly appreciated. I have a file cat input1.bed chr1 100 200 abc chr1 120 300 def chr1 145 226 ghi chr2 567 600 unix Now, I have another file by name input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

10. Shell Programming and Scripting

Can't get my program to run -- GC calculator?

have been trying for a few weeks not to get this program running. I am newer to programming and it has definitely been a challenge. I think my problem arises with my if statement. I can get it to append the name to the new file, but it simply appends the whole sequence to the file rather than... (3 Replies)
Discussion started by: haley6719
3 Replies
create-branching-keyboard(1)					   User Commands				      create-branching-keyboard(1)

NAME
create-branching-keyboard - create branching keyboards for GOK SYNOPSIS
create-branching-keyboard [--usage] infile [n-desired-rows] DESCRIPTION
create-branching-keyboard takes an input data file and creates a family of branching keyboard XML files in the format that GOK expects. Given an input file named test.data, create-branching-keyboard creates test.data.kbd, which in turn refers to a family of *.kbd files that are created based on data in the input file. OPTIONS
The following options are supported: --usage Display usage information. OPERANDS
The following operands are supported: infile The name of the input file. n-desired-rows If specified, create-branching-keyboard attempts to create keyboards with the specified number of rows. The recommended values are between 2 and 6. EXTENDED DESCRIPTION
create-branching-keyboard can be used to create families of branching keyboards from UTF-8 input files. The format of the input files is as follows: o Lines beginning with '#' are ignored. o The rest of the input file consists of consecutive pairs of lines. The first line of a pair is typically ignored, but should serve as a UTF-8 label describing the "primary key" in the next line. The second line of the pair consists of a single UTF-8 character followed by a ':' color delimiter, and a string of UTF-8 characters to which the initial character may branch. The resulting XML file, after processing, defines .kbd files such that each prefix 'primary key' forms a key on the GOK keyboard whose label is the "primary key" UTF-8 character, and which branches to a keyboard consisting of the following UTF-8 characters, one per key. create-branching-keyboard is particularly useful in creating branching keyboards for ideographic languages. For instance, the primary key for a given line may consist of the UTF-8 character for a 'radical' such as hng. EXAMPLES
Example 1: Creating Branching Keyboards From a File Called test.data example% create-branching-keyboard test.data EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/create-branchinExecutable to create branching keyboards for GOK ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-a11y-gok-share | | | | | |SUNWgnome-a11y-gok | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. gok(1) NOTES
The create-branching-keyboard utility is experimental and unsupported. Written by Bill Haneman, Sun Microsystems Inc., 2004. SunOS 5.10 7 Sep 2004 create-branching-keyboard(1)
All times are GMT -4. The time now is 07:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy