ini

How do I get value of variable from file using shell script?

▼魔方 西西 提交于 2019-12-19 10:17:04
问题 There is a file post_check.ini I need the value set for: Max_value=2 How would I get the value 2 from Max_value ? 回答1: try grep -Po '(?<=Max_value=).*' post_check.ini 回答2: Max_value=$(sed -n '/^Max_value=\([0-9]*\)$/s//\1/p' post_check.ini) 回答3: I recommend using crudini which is a dedicated tool to manipulate ini files from shell value=$(crudini --get /usr/post_check.ini section Max_value) Details on usage and download at: http://www.pixelbeat.org/programs/crudini/ 回答4: You might find it

delphi中ini 文件操作记要(1): 使用 TIniFile

断了今生、忘了曾经 提交于 2019-12-19 06:15:04
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject);

PHP - Parse ini file and access single values

风格不统一 提交于 2019-12-19 04:02:08
问题 In Python you can parse an .ini file and access the single values like this: myini.ini [STRINGS] mystring = fooooo value = foo_bar script.py import configparser config = configparser.ConfigParser() # ---------------------------------------------------------------------- config.read("myini.ini") test = config["STRINGS"]["mystring"] print (test) #-> OUTPUT: fooooo How can I do the same in PHP? Unfortunately, I was not able to find any examples. 回答1: Not to fear, parsing an .ini file is a

Writing comments to ini file with boost::property_tree::ptree

耗尽温柔 提交于 2019-12-19 03:17:05
问题 Is there any way to write comments in an ini file using boost::property::ptree ? Something like that: void save_ini(const std::string& path) { boost::property_tree::ptree pt; int first_value = 1; int second_value = 2; // Write a comment to describe what the first_value is here pt.put("something.first_value", ); // Write a second comment here pt.put("something.second_value", second_value); boost::property_tree::write_ini(path, pt); } The documentation here doesn't give the info. Did boost

Writing comments to ini file with boost::property_tree::ptree

怎甘沉沦 提交于 2019-12-19 03:16:19
问题 Is there any way to write comments in an ini file using boost::property::ptree ? Something like that: void save_ini(const std::string& path) { boost::property_tree::ptree pt; int first_value = 1; int second_value = 2; // Write a comment to describe what the first_value is here pt.put("something.first_value", ); // Write a second comment here pt.put("something.second_value", second_value); boost::property_tree::write_ini(path, pt); } The documentation here doesn't give the info. Did boost

How to enable uWSGI logging to a file?

夙愿已清 提交于 2019-12-18 19:05:20
问题 I have just installed my first uWSGI server on EC2 Ubuntu 14.04 LTS, using the following configuration: [uwsgi] http-socket = :9001 plugin = python wsgi-file = foo.wsgi chdir = /home/bar process = 3 The uWSGI container works fine, but has no logging. Following the manual, I've added the following: logger = file:/tmp/errlog But restarting (using sudo service uwsgi restart ) did not work - the server would not start with this configuration. Any idea what's missing from my ini configuration? 回答1

Pyramid and .ini configuration

浪子不回头ぞ 提交于 2019-12-18 11:49:27
问题 Each Pyramid application has an associated .ini file that contains its settings. For example, a default might look like: [app:main] use = egg:MyProject pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false ... I am wondering if it is possible to add your own configuration values in there, and read them at run-time (mostly from a view callable). For instance, I might want to have [app:main] blog.title = "Custom blog

Function Get-IniContent is not recognized - INI file support inPowerShell

假装没事ソ 提交于 2019-12-18 05:27:12
问题 I want to edit the value of INI file. I use this script but It gives me error. Get-IniContent : The term 'Get-IniContent' is not recognized as the name of a cmdlet, function, script file, or operable program. The contents of my INI file at c:\Users\file.ini : [XXX] AB=23 BC=34 The contents of the script for reading and updating it: # Read the content of an *.ini file into a (nested) hashtable. $ini = Get-IniContent "C:\Users\file.ini" # Update the 'AB' entry in section [XXX] in-memory. $ini[

Ini Files - Read Multi Lines?

Deadly 提交于 2019-12-18 03:39:25
问题 I am aware that Ini Files are meant for single lines of information, needless to say I am trying to read/write multi lines to and from the Ini - without much success (I always seem to do things the hard way!) Lets say my Ini File when saved, looks like this: [richardmarx] Filenames=hazard children of the night right here waiting Suppose the Ini File is built dynamically (ie, the richardmarx and the Filenames are not know, but unique - they could literally be anything). How would I be able to

Is it possible to use inline comments for .ini files with PHP?

佐手、 提交于 2019-12-18 01:28:11
问题 Is it possible and safe to use inline comments for .ini files with PHP? I prefer a system where the comments are inline with the variables, coming after them. Are the some gotchas concerning the syntax to be used? 回答1: INI format uses semicolon as a comment character. It accepts them anywhere in the file. key1=value ; this is a comment key2=value ; this is a comment too 回答2: If you're talking about the built-in INI file parsing function, semicolon is the comment character it expects, and I