I started playing around with Python (2.6.6) trying to parse a file. No matter what I tried so far I am not able to print only the lines/group/backreference that have been affected by the substitution. Instead I get also the other lines too
File to parse:
Current code:
I assume there is something needed like the behavior of sed's -n and /p to basically print nothing but the lines that have been matched.
Output:
Expected output:
I saw that there are more functions/methods in the module re like re.group etc. but I would like to know why it doesn't work with my example.
Thanks in forward for a hint with this rather basic problem.
In a file, field separetor in line is irregular number of spaces, so I canot use field in sub function to get my charecter replaced with empty space. I would like to substitute only one perticular charecter with space at perticular posiotn, so I canot use perticular character as that may occur... (6 Replies)
I have to stop the output of dd from writing to terminal. Here is the command:
sudo dd if=boot1h of="/dev/r$temp1"
Here is the output:
2+0 records in
2+0 records out
1024 bytes transferred in 0.000804 secs (1273715 bytes/sec)
I have tried >> log.txt but it doesn't work. Is there... (4 Replies)
I try to run this script, however, it gives an exception in line 3. How do I do an assignment to a substituted variable?
#!/bin/bash
name=fruit
ext_$(eval echo ${name})=apple
tmp=ext_$(eval echo ${name})
if ]; then
echo "apple"
elif ]; then
echo "orange"
fi
echo ${!tmp}
Error... (2 Replies)
Is there any way to produce a code with all use dmacro to be substituted up to 'ready for compilation' condition?
Some macro are build up and it is hard to replace all them up to final code by hand.
I need to see the final line after all macro been applied by preprocessor.
How that could be... (5 Replies)
Hello everyone,
Here's the problem, I have a list generated by this command;
watch -n 5 'iptables -nvL | grep "DROP"'
It generates output that looks like this (severely truncated for clarity)
Every 5.0s: iptables -nvL | grep "DROP" ... (2 Replies)
Hi,
Please can you tell me what the last two lines in the python code below are doing?
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
print 'data has %d characters, %d unique.' % (data_size,... (2 Replies)
Hi all...
As you know I like making code backwards compatible for as many platforms as possible.
This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies
LEARN ABOUT NETBSD
override_config_file
override_config_file(3alleg4) Allegro manual override_config_file(3alleg4)NAME
override_config_file - Specifies a file containing config overrides. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
void override_config_file(const char *filename);
DESCRIPTION
Specifies a file containing config overrides. These settings will be used in addition to the parameters in the main config file, and where
a variable is present in both files this version will take priority. This can be used by application programmers to override some of the
config settings from their code, while still leaving the main config file free for the end user to customise. For example, you could spec-
ify a particular sample frequency and IBK instrument file, but the user could still use an `allegro.cfg' file to specify the port settings
and irq numbers.
The override config file will not only take precedence when reading, but will also be used for storing values. When you are done with using
the override config file, you can call override_config_file with a NULL parameter, so config data will be directly read from the current
config file again.
Note: The override file is completely independent from the current configuration. You can e.g. call set_config_file, and the override file
will still be active. Also the flush_config_file function will only affect the current config file (which can be changed with set_con-
fig_file), never the overriding one specified with this function. The modified override config is written back to disk whenever you call
override_config_file.
Example:
override_config_file("my.cfg");
/* This will read from my.cfg, and if it doesn't find a
* setting, will read from the current config file instead.
*/
language = get_config_string("system", "language", NULL);
/* This will always write to my.cfg, no matter if the
* settings is already present or not.
*/
set_config_string("system", "language", "RU");
/* This forces the changed setting to be written back to
* disk. Else it is written back at the next call to
* override_config_file, or when Allegro shuts down.
*/
override_config_file(NULL);
Note that this function and override_config_data() are mutually exclusive, i.e. calling one will cancel the effects of the other.
SEE ALSO override_config_data(3alleg4), set_config_file(3alleg4)Allegro version 4.4.2 override_config_file(3alleg4)