Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trying to show lines in INI files until the comment character (#) Post 302455430 by hindesite on Tuesday 21st of September 2010 02:37:37 PM
Old 09-21-2010
Quote:
Originally Posted by john1212
Code:
grep $varEQ *.ini | sed -n 's/\(.*\)#.*/\1/p' >> /tmp/ini_FTP_settings_$INTFC.lst

John1212: I think yours has the greatest chance of working. At this point, it does not. When a line is encountered with a pound sign, nothing is returned and appended to my output. (What is appended is the filename: portion of the stdout from grepping across multiple files.) Is there a small sytax error in your sed substitution code? I am not good at sed yet, and would appreciate you looking at it a second time.

Danny H., hindesite
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to comment multiple lines in unix

hi all, please help me how to comment multiple lines in unix script. thanks in advance --bali (3 Replies)
Discussion started by: balireddy_77
3 Replies

2. UNIX for Dummies Questions & Answers

comment lines

Is there a command to put a comment (#) in a whole part of a shell script? (5 Replies)
Discussion started by: vero_81
5 Replies

3. Shell Programming and Scripting

script assistance needed - create an archive of INI files

First and foremost - me != unix bubba. Here is the situation. We have a box with data AND settings in the same directory path. (Data files aren't in the SAME directories as settings.) I need a script that generates a tarred-up archive of only the INI files with the directory structure. We... (2 Replies)
Discussion started by: hindesite
2 Replies

4. Shell Programming and Scripting

sed show lines text between 2 blank lines

I have a file like blah blah blah blah this is the text I need, which might be between 1-4 lines, but always has a blank line above and below it, and is at the end of the text file the code tags don't show the trailing blank line. I started by deleting the last blank line with: ... (2 Replies)
Discussion started by: unclecameron
2 Replies

5. Shell Programming and Scripting

How can i comment out a section between two particular lines

I want to find out which files under /etc have the the following section: and then i would like to comment out the above section in all the files. Please help. (3 Replies)
Discussion started by: proactiveaditya
3 Replies

6. Shell Programming and Scripting

Comment lines in FSTAB using perl

Hi All, I need to comment specific Two Lines in fstab & want to do using & also want to ensure that is done corretly. I am trying the below method. But its giving Search pattern not terminated. ################ b36376 67 % cat linux-fstab_testing | perl -i -wnl -e '/^('\Q... (1 Reply)
Discussion started by: ajaincv
1 Replies

7. UNIX for Dummies Questions & Answers

Comment lines in file without vi editor

Legends, Can you please help me in following. I need to comment lines from “/tmp/a.txt” from the line A to line B through the command prompt only. Please use variables not direct values like 2 or 5 It can be done with VI editor but it's not matches with my requirement (: 2,5 s/^/#/g). ... (1 Reply)
Discussion started by: sdosanjh
1 Replies

8. UNIX for Dummies Questions & Answers

Append two lines of text to php.ini in the entire directory tree.e

I am looking to write a script that will read the php.ini files on my web host. If the two lines do exist do nothing. If not append two lines to the end of it then move on to the next directory and open the next php.ini file. I have the beginning of one that was given to me on another web site but... (6 Replies)
Discussion started by: Larrykh465
6 Replies

9. Shell Programming and Scripting

Bash: copying lines with specific character to files with same name as copied line.

I am trying to make my script as simple as a possible but, I am not sure if the way I am approaching is necessarily the most efficient or effective it can be. What I am mainly trying to fix is a for loop to remove a string from the specified files and within this loop I am trying to copy the lines... (2 Replies)
Discussion started by: Allie_gastrator
2 Replies
Config::INI(3pm)					User Contributed Perl Documentation					  Config::INI(3pm)

NAME
Config::INI - simple .ini-file format VERSION
version 0.019 SYNOPSIS
Config-INI comes with code for reading .ini files: my $config_hash = Config::INI::Reader->read_file('config.ini'); ...and for writing ".ini" files: Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini'); See Config::INI::Writer and Config::INI::Reader for more examples. GRAMMAR
This section describes the format parsed and produced by Config::INI::Reader and ::Writer. It is not an exhaustive and rigorously tested formal grammar, it's just a description of this particular implementation of the not-quite-standardized "INI" format. ini-file = { <section> | <empty-line> } empty-line = [ <space> ] <line-ending> section = <section-header> { <value-assignment> | <empty-line> } section-header = [ <space> ] "[" <section-name> "]" [ <space> ] <line-ending> section-name = string value-assignment = [ <space> ] <property-name> [ <space> ] "=" [ <space> ] <value> [ <space> ] <line-ending> property-name = string-without-equals value = string comment = <space> ";" [ <string> ] line-ending = [ <comment> ] <EOL> space = ( <TAB> | " " ) * string-without-equals = string - "=" string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ? Of special note is the fact that no escaping mechanism is defined, meaning that there is no way to include an EOL or semicolon (for example) in a value, property name, or section name. If you need this, either subclass, wait for a subclass to be written for you, or find one of the many other INI-style parsers on the CPAN. The order of sections and value assignments within a section are not significant, except that given multiple assignments to one property name within a section, only the final one is used. A section name may be used more than once; this will have the identical meaning as having all property assignments in all sections of that name in sequence. DON'T FORGET The definitions above refer to the format used by the Reader and Writer classes bundled in the Config-INI distribution. These classes are designed for easy subclassing, so it should be easy to replace their behavior with whatever behavior your want. Patches, feature requets, and bug reports are welcome -- but I'm more interested in making sure you can write a subclass that does what you need, and less in making Config-INI do what you want directly. THANKS
Thanks to Florian Ragwitz for improving the subclassability of Config-INI's modules, and for helping me do some of my first merging with git(7). ORIGIN
Originaly derived from Config::Tiny, by Adam Kennedy. AUTHOR
Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2011-12-15 Config::INI(3pm)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy