Sponsored Content
Top Forums Shell Programming and Scripting [All variants] Change settings Post 302992619 by useretail on Monday 27th of February 2017 08:10:58 PM
Old 02-27-2017
[All variants] Change settings

Hi, I have a big settings confg (file attached). There are a few separate tasks that I have to accomplish. All scripting/programming languages are appreciated.

1. I need to parse all values and output to stdout. Sample output (truncated):
Code:
VALUEA
2017-01-01
Lores ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

VALUEB
2017-02-02
...

2. I need to create a new setting DATEB and write it to file before TEXT by adding n days to value of DATEA. For example here I added 300 days (truncated):
Code:
#SETTINGSBEGIN VALUEA
#DATEA 2017-01-01
...
#DATEB 2017-10-28
TEXT
...
#SETTINGSEND

#SETTINGSBEGIN VALUEB
#DATEA 2017-02-02
...
#DATEB 2017-11-29
TEXT
...
#SETTINGSEND

#SETTINGSBEGIN VALUEС
#DATEA 2017-03-03
...
#DATEB 2017-12-28
TEXT
...
#SETTINGSEND

 

9 More Discussions You Might Find Interesting

1. Solaris

how do I change locale settings?

I support a product which writes to log files and it's currently formatting the date in US format. I've established this is due to these settings: account1# locale -k d_fmt t_fmt d_fmt="%m/%d/%y" t_fmt="%H:%M:%S" If I log on with a different account the settings are different: ... (1 Reply)
Discussion started by: m223464
1 Replies

2. UNIX for Dummies Questions & Answers

How to change root's .profile settings

As a regular (non-root) user on Unix servers I'm accustomed to changing my .profile file to set paths that I frequently use, etc. I am trying to learn unix and set up a test server running SunOS 5.8. When I login as root I don't see a .profile file that belongs to root wherein I could change the... (1 Reply)
Discussion started by: FredSmith
1 Replies

3. HP-UX

command to change duplex settings..

Hi Folks, I want the command to change the duplex settings of a HP-UX server. Thanks in advance. Sagar. (2 Replies)
Discussion started by: sag71155
2 Replies

4. Solaris

effect of change of mpd preferred path settings

Hello All, In the output of the command "mpdcontrol -no xlist", I found that, some of the preferred paths are marked as "err". You can see the output below: # mpdcontrol -noxlist Unit Dev# MPD_ID/Policy DeviceName FC_AL DevMajMin IOcnt State... (0 Replies)
Discussion started by: sundar3350
0 Replies

5. Solaris

Putty : Change default settings (solved)

Hi, I use to work on solaris via putty and always on session start - i use to increase the font to 14 bold - capture session output to a file my requirement) to make these changes permanent, so that i need not to change the settings everytime i connect via putty please advice. ... (0 Replies)
Discussion started by: saurabh84g
0 Replies

6. AIX

Settings change in aix

Hi Can any one tell the procedure to change the maxpout and minpout settings on AIX (1 Reply)
Discussion started by: newtoaixos
1 Replies

7. Red Hat

Change user settings..

Hi, I have 48 cores in my server. I want to assign 50% of the cores to certain programs and rest to some other programms. I found the command "taskset" very good option to assign cpu afinity to already running programms or newly created programms. But the problem is even if i set a cron to... (1 Reply)
Discussion started by: Rantu
1 Replies

8. UNIX for Dummies Questions & Answers

Change default settings of nslookup

how and where can i change permanent the settings of nslookup? each time i change it by doing nslookup set timeout=2 the nslookup , does not save the settings , how can i do it in permanent way? (2 Replies)
Discussion started by: prpkrk
2 Replies

9. Shell Programming and Scripting

[All variants] remove first pair of parentheses

How to remove first pair of parentheses and content in them from the beginning of the line? Here's the list: (ok)-test (ok)-test-(ing) (some)-test-(ing)-test test-(ing) Desired result: test test-(ing) test-(ing)-test test-(ing) Here's what I already tried with GNU sed: sed -e... (6 Replies)
Discussion started by: useretail
6 Replies
Text::Wrap(3)						User Contributed Perl Documentation					     Text::Wrap(3)

NAME
GD::Text::Wrap - Wrap strings in boxes SYNOPSIS
use GD; use GD::Text::Wrap; my $gd = GD::Image->new(800,600); # allocate colours, do other things. my $text = <<EOSTR; Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. EOSTR my $wrapbox = GDTextWrap->new( $gd, line_space => 4, color => $black, text => $text, ); $wrapbox->set_font(gdMediumBoldFont); $wrapbox->set_font('arial', 12); $wrapbox->set(align => 'left', width => 120); $wrapbox->draw(10,140); $gd->rectangle($wrap_box->get_bounds(10,140), $color); DESCRIPTION
GD::Text::Wrap provides an object that draws a formatted paragraph of text in a box on a GD::Image canvas, using either a builtin GD font or a TrueType font. METHODS
This class doesn't inherit from GD::Text directly, but delegates most of its work to it (in fact to a GD::Text::Align object. That means that most of the GD::Text::Align methods are available for this class, specifically "set_font" and "font_path". Other methods and methods with a different interface are described here: GD::Text::Wrap->new( $gd_object, attribute => value, ... ) Create a new object. The first argument to new has to be a valid GD::Image object. The other arguments will be passed to the set() method for initialisation of the attributes. $wrapbox->set( attribute => value, ... ) set the value for an attribute. Valid attributes are: width The width of the box to draw the text in. If unspecified, they will default to the width of the GD::Image object. line_space The number of pixels between lines. Defaults to 2. para_space, paragraph_space The number of extra pixels between paragraphs, above line_space. Defaults to 0. color, colour Synonyms. The colour to use when drawing the font. Will be initialised to the last colour in the GD object's palette. align, alignment Synonyms. One of 'justified' (the default), 'left', 'right' or 'center'. text The text to draw. This is the only attribute that you absolutely have to set. preserve_nl If set to a true value, newlines in the text will cause a line break. Note that lines will still be justified. If only one word appears on the line, it could get ugly. Defaults to 0. As with the methods, attributes unknown to this class get delegated to the GD::Text::Align class. $wrapbox->get( attribute ); Get the current value of an attribute. All attributes mentioned under the "set()" method can be retrieved $wrapbox->get_bounds() Returns the bounding box of the box that will be drawn with the current attribute settings as a list. The values returned are the coordinates of the upper left and lower right corner. ($left, $top, $right, $bottom) = $wrapbox->get_bounds(); Returns an empty list on error. NOTE: The return list of this method may change in a future implementation that allows angled boxes. $wrapbox->draw(x, y) Draw the box, with (x,y) as the top right corner. Returns the same values as the "getbounds()" method. NOTE: The return list of this method may change in a future implementation that allows angled boxes. NOTES
As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much with knowledge of the internals of this module, you may get burned. I may change them at any time. You can only use TrueType fonts with version of GD > 1.20, and then only if compiled with support for this. If you attempt to do it anyway, you will get errors. Even though this module lives in the GD::Text namespace, it is not a GD::Text. It does however delegate a lot of its functionality to a contained object that is one (GD::Text::Align). BUGS
None that I know of, but that doesn't mean much. There may be some problems with exotic fonts, or locales and character encodings that I am not used to. TODO
Angled boxes. At the moment, the only bit of the box that is allowed to be unspecified and in fact must be unspecified, is the bottom. If there is enough need for it, I might implement more flexibility, in that that you need to only specify three of the four sides of the box, and the fourth will be calculated. Automatic resizing of a TrueType font to fit inside a box when four sides are specified, or maybe some other nifty things. More flexibility in the interface. Especially draw needs some thought. More and better error handling. Warnings for lines that are too long and stick out of the box. Warning for emptyish lines? COPYRIGHT
copyright 1999 Martien Verbruggen (mgjv@comdyn.com.au) SEE ALSO
GD, GD::Text, GD::Text::Align perl v5.12.1 2003-02-24 Text::Wrap(3)
All times are GMT -4. The time now is 02:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy