Sponsored Content
Top Forums Programming Python Reading Individual files and Regex through them Post 302871213 by Corona688 on Tuesday 5th of November 2013 04:46:52 PM
Old 11-05-2013
Why add the filenames to a list? Why not just use the filenames, when you get them?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Create individual tgz files from a set of files

Hello I have a ton of files in a directory of the format app.log.2008-04-04 I'd like to run a command that would archive each of these files as app.log.2008-04-04.tgz I tried a few combinations of find with xargs etc but no luck. Thanks Amit (4 Replies)
Discussion started by: amitg
4 Replies

2. Shell Programming and Scripting

Help Reading XML files in Python: Urgent

OK so my objective is to create a python program that will parse an XML file(input.xml), then the program will create an mxml(output.mxml) file. In the program (.py) i need to read between CDATA so that I would get an output the CDATA code in the input.xml INPUT.XML <!]> ... (2 Replies)
Discussion started by: dcfivesixfive
2 Replies

3. Shell Programming and Scripting

Python Regex

I have the below string and regex. However I cant understand why it works the way it does. IP has been changed for safety ;) String = NowSMS Error Report. Error initializing SMSC Interface 'SMPP - 10.15.8.10:17600'. Interface is not available. Regex = (.+\.)\s(.+) I get two... (1 Reply)
Discussion started by: barney34
1 Replies

4. Shell Programming and Scripting

Apply 'awk' to all files in a directory or individual files from a command line

Hi All, I am using the awk command to replace ',' by '\t' (tabs) in a csv file. I would like to apply this to all .csv files in a directory and create .txt files with the tabs. How would I do this in a script? I have the following script called "csvtabs": awk 'BEGIN { FS... (4 Replies)
Discussion started by: ScKaSx
4 Replies

5. Shell Programming and Scripting

Find regex, place on individual lines and insert blank line before

Hello, I have a file that I want to be able to insert a new line before every instance of a regex. I can get it to do this for each line that contains the regex, but not for each instance. Contents of infile: Test this 1... Test this 2... Test this 3... Test this 4... Test this... (2 Replies)
Discussion started by: deneuve01
2 Replies

6. Shell Programming and Scripting

Python Newbie Question Regex

I starting teaching myself python and am stuck on trying to understand why I am not getting the output that I want. Long story short, I am using PDB for debugging and here my function in which I am having my issue: import re ... ... ... def find_all_flvs(url): soup =... (1 Reply)
Discussion started by: metallica1973
1 Replies

7. Programming

Python reading from a file

Hello everyone, I've been learning some python (I was using other commercial software before), and doing plots from data stored on files as X and Y pairs has not been an issue. Know, I have some files that look like this: <Descriptive string> <some "random" number> <number of X values:nx>... (0 Replies)
Discussion started by: jaldo0805
0 Replies

8. Shell Programming and Scripting

Python Regex Removing One Too Many...

Well, I'm a python noob and my last post here I was introduced to Regex. I thought this would be easy since I knew Regex with Bash. However, I've been banging my head a while to extract an ip address from ifconfig with this: #!/usr/bin/python import re import subprocess from subprocess... (5 Replies)
Discussion started by: Azrael
5 Replies

9. Programming

Python Regex List Creation

Here is a snippet of my code: blahblahblah... blah for link in goodies.soup.find_all('a'): blah.append(link.get('href')) blah=list(set(blah)) which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list: for r... (0 Replies)
Discussion started by: metallica1973
0 Replies

10. Shell Programming and Scripting

Python with Regex and Excel

Hello I have a big excel file for Ticket Data Analysis. The idea is to make meaningful insight from Resolution Field. Now as people write whatever they feel like while resolving the ticket it makes quite a task. 1. They may or may not tag it with something like below within the resolution... (1 Reply)
Discussion started by: radioactive9
1 Replies
CLIAPP(5)							File Formats Manual							 CLIAPP(5)

NAME
cliapp - config file and option conventions for Python command line framework DESCRIPTION
cliapp is a Python programming framework for writing command line applications for Unix-like operating systems. This manual page describes the conventions for configuration files and command line parsing provided by cliapp. Configuration file variables and command line options are handled by cliapp under a uniform abstraction: every setting is available both in configuration files and command line options. There are a few settings, provided by the framework itself, which are only available on the command line. For example, --help outputs a short help text, listing all the available options, and --dump-config outputs a list of cur- rent configuration settings. Command line parsing follows GNU conventions: short options start with a single dash, long options with two dashes, and options may be used anywhere on the command line. The order of options versus non-options does not matter. The exception is some of the options provided by the framework, which are executed immediately when found, and may be prevent the rest of the options from being parsed. (--dump-config is one of these, so use it at the end of the command line only.) Some settings may have aliases, which can be only a single character, and in that case they're parsed as single-character option names. Some applications have subcommands, which means that the first non-option argument is used to tell the application what to do. This is similar to what many version control systems do, for example CVS, svn, bzr, and git. Options are global, and are not specific to subcom- mands. Thus, --foo means the same thing, regardless of what subcommand is being used. Configuration files Configuration files use INI file syntax. All the settings are in the [config] section. Other sections are allowed, but it is up to the application to give meaning to them. Multiple configuration files may be read. Settings from later ones override settings from earlier ones. Options override settings from the configuration files. String list settings Some settings may be a list of values (each value being a string). For example, there might be a setting for patterns to search for, and multiple patterns are allowed. On the command line, that happens by using the option multiple times. In the configuration file, all val- ues are given on one line, separated by commas. This is a non-standard extension to the INI file syntax. There is no way to escape com- mas. Example: [config] pattern = foo, bar, foobar Boolean (true/false or on/off or yes/no) settings When a setting can be either on or off, it's called a Boolean setting. Such settings are turned off by default, and turned on if used on the command line. In a configuration file, they need to be set to a value: if the value is one of yes, on, true, or the number 1, the set- ting is turned on. Any other value means it is turned off. [config] verbose = true attack-kittens = no This turns the verbose setting on, but does not launch attack kittens. Logging and log files Programs using cliapp automatically support several options for configuring the Python logging module. See the --help output for options starting with log for details. Logging can happen to a file or the system log. Log files can be rotated automatically based on size. The --trace option enables additional debug logging, which is usually only useful for programmers. The option configures the tracing library for Python, by Lars Wirzenius, which allows logging values of variables and other debug information in a way that is very light- weight when the tracing is turned off. The option specifies for which source code files to turn on tracing. The actual logging happens via the normal Python logging facilities, at the debug level. Python profiling support You can run the application under the Python profiler (cProfile) by setting an environment variable. The name of the variable is FOO_PRO- FILE, where FOO is the name of the program, as set by the application code or determined by cliapp automatically. The value of the envi- ronment variable is the name of the file to which the resulting profile is to be written. FILES
cliapp reads a list of configuration files at startup, on behalf of the application. The name of the application is included in the name. In the filenames below, the application name is progname. /etc/progname.conf Global configuration file. /etc/progname/*.conf More global configuration files. These are read in ASCII sorted order. ~/.progname.conf Per-user configuration file. ~/.config/progname/*.conf More per-user configuration files. Again, ASCII sorted order. CLIAPP(5)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy