$f is the name of each file that is processed.
The find command creates a list of file name, that are then read one at a time into the $f variable by the do loop.
You might experiment with the following code to clean up your files.
This will remove all the existing lines and replace them with whatever is in $line3 and $line4.
Be sure to do a backup before starting.
Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management.
Thanks in advance-
Brian- (2 Replies)
I can't use mysql .How should i config the file of php.ini . the message:
Fatal error: Call to undefined function mysql_errno() in /var/www/html/inc/dv_clssql.php on line 129
how should i do? please help me (2 Replies)
I have a working directory on a server with over 100 INI files. For the most part, they are configured the same way. Each line will contain 1 or none variables listed from the first character in the line such as VariableName=0.
Unfortunately there are comments everywhere using the... (4 Replies)
Hi,
I've spent some time researching for this but can't seem to find a solution. I have a file like this
1234|Test|20101111|18:00|19:00There will be multiple lines in the file with the same kind of format. For every line I need to make it this
1234|Test|20101111|18:00|19:00||create... (5 Replies)
Hello,
I have 50 text files in a directory called "AllFiles"
I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
Hi,
I have installed ubuntu server lamp.
When I used the command locate to find the php.ini file I found two location.
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
When I want to change the setting of the php, which one of them should I change and why I have this file twice? (3 Replies)
Hi,
I want to append "chr" to all col 2 values of all files in a particular folder.
This is what I came up with but isnt working. Please help.
ls -1 * |
(
while read line
do
awk 'BEGIN {FS=OFS=":"} {$2="chr"$2;print $0}' $line > $line_new
done
)
Another question is, how to delete... (7 Replies)
I am new to Perl. I wrote a Perl program that inserts text "EnableScrollableCursors=3" after a section of contexts in the odbc.ini file matches a variable in an array list. "EnableScrollableCursors=3" is added to a newline before whitespaces separate each section of contexts in the odbc.ini.
... (0 Replies)
How to get a file 'zlib.h' in an entire directory with an excluded directory specified lives under that starting directory by using find command, as it failed on:
$ find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print
it'll just list entirely up (2 Replies)
Discussion started by: abdulbadii
2 Replies
LEARN ABOUT DEBIAN
cfget
CFGET(1) User Commands CFGET(1)NAME
cfget - get values from a config file
SYNOPSIS
cfget [options] section/key
cfget [options] --dump=STYLE [section/key [section/key...]]
cfget [options] --template=STYLE [infile [outfile]]
DESCRIPTION
Get values from a config file.
cfget is a simple tool to read values from configuration files. It is useful, for example, to create configurable shellscripts or make-
files.
It can also be configured to support virtual configuration values that, if not present in the config file, are automatically computed from
the existing values. This makes it convenient, for example, to get a "duration" value from a configuration file that only contains a "start
date" and an "end date".
OPTIONS --version
show program's version number and exit
-h, --help
show this help message and exit
-q, --quiet
quiet mode: only output fatal errors
-v, --verbose
verbose mode
--debug
verbose mode
-C file, --cfg=file
config file to read; the option can be given more than once to read more than one file. If missing, read a colon separated list from
the CFGET_CFG env variable.
-P file, --plugin=file
list of plugin files or directories to load. The option can be given more than once to read more than one file. If missing, read a
colon separated list from the CFGET_PLUGINS env variable.
-d name, --dump=name
dump the contents of the database using the given style. Use '--dump=list' for a list of available styles. If one or more paths are
provided in the command line, dump only those paths, otherwise dump all.
-t name, --template=name
read a template file, expand template placeholders using the configuration data and output the result. Use '--template=list' for a
list of available styles.
-f name, --format=name
use a custom configuration file format (default: ini). Use '--format=list' for a list of available formats. The CFGET_FORMAT envi-
ronment value, if defined, can be used to provide a different default value.
-r path, --root=path
restrict all work to values under the given path
EXAMPLES
# Get a key from a config file
cfget -C file.ini general/name
# More can be specified, they will be searched in order
cfget -C general.ini -C local.ini general/name
# Use a plugin to add virtual entries
cfget -C file.ini --plugin=virtual.py general/name
# A plugin can also a directory containing .py files
# and plugins can also be specified more than once
cfget -C file.ini --plugin=virtual.py --plugin=virtual/ general/name
# In a shellscript, you may want to use environment variables if you
# invoke cfget many times:
#!/bin/sh
CFGET_CFG=general.ini:local.ini
CFGET_PLUGINS=virtual.py:virtual/
START=`cfget general/start`
END=`cfget general/end`
DURATION=`cfget general/duration`
# Quick way to copy all config values to the environment
eval `cfget --dump=exports -C file.ini`
# Autoconf-style template substitution
cfget --template=autoconf -C file.ini script.in script
# Curly braces substitude literally
cfget -C file.ini "general/start_{general/type}"
# One can use simple expressions
cfget -C file.ini "general/start + general/duration"
cfget -C file.ini "round(general/age / 2)"
AUTHOR
cfget has been written by Enrico Zini <enrico@enricozini.org>.
cfget 0.15 July 2010 CFGET(1)