Sponsored Content
Full Discussion: swap fields in a file
Top Forums UNIX for Dummies Questions & Answers swap fields in a file Post 302252816 by ChicagoBlues on Thursday 30th of October 2008 10:58:16 AM
Old 10-30-2008
sweet... it works.

Thanks,

- CB
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Swap file

I just started working with AIX and need a little help. Is there a command to find the size of the swap file. (1 Reply)
Discussion started by: paule
1 Replies

2. UNIX for Dummies Questions & Answers

File name swap

I'm trying to write a shell script that accepts two file extensions as command line arguments and renames all files with the first extension within the current working directory to have the second extension instead. The script should print out error messages as is appropriate if there is any... (1 Reply)
Discussion started by: asianmike
1 Replies

3. Solaris

swap file not present

Hello all, We are running a 2 gig Solaris10 system. The only application that's running on the system is ours which allocates 850MB through malloc at one shot. For some reason this malloc keeps failing saying "Resource Temporarily Unavilable" After some investigation, found that it goes... (7 Replies)
Discussion started by: Naanu
7 Replies

4. Solaris

Swap config - Mirror swap or not?

Hello and thanks in advance. I have a Sun box with raid 1 on the O/S disks using solaris svm. I want to unmirror my swap partition, and add the slice on the second disk as an additional swap device. This would give me twice as much swap space. I have been warned not to do this by some... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

5. UNIX for Advanced & Expert Users

Swap file system

This questions only concerns Solaris 10. Let's say I have swap configured like so in /etc/vfstab: /dev/dsk/c1t0d0s1 - - swap - no - /dev/dsk/c1t1d0s1 - - swap - no - /dev/md/dsk/d1 - - swap - no - ... (1 Reply)
Discussion started by: bluescreen
1 Replies

6. HP-UX

Swap device file and swap sapce

Hi I have an integrity machine rx7620 and rx8640 running hp-ux 11.31. I'm planning to fine tune the system: - I would like to know when does the memory swap space spill over to the device swap space? - And how much % of memory swap utilization should be specified (swap space device... (6 Replies)
Discussion started by: lamoul
6 Replies

7. UNIX for Dummies Questions & Answers

How to swap parts of a file name?

I have a number of files that a structured like this: Eg. file_name.ext1 another file name with spaces.ext2 yatf with .ext3 also a file (plus).ext4 I would like to swap the part with the descriptive_file_name part, so that it looks like this: Eg. file_name .ext1 I know (or... (4 Replies)
Discussion started by: invenio
4 Replies

8. UNIX for Dummies Questions & Answers

vi editor swap file please help

Hi, when using vi editor, why do i automatically create swap file. this is very hard on me as on some systems i do not have remove file permission and swap file is only readable. it always happens to me, regardless of the computer i am using. does not happen to my classmates. i don't even know the... (2 Replies)
Discussion started by: hobiwhenuknowme
2 Replies

9. Shell Programming and Scripting

Swap of fields dynamically

Dear Friends, I have file a.txt 1|2|3|4|5|6|7|8 a|b|c|d|e|f|g|h i am using the below code to swap the fields in file awk -F\| '{print $5,$1,$2,$3,$4,$6,$7,$8}' OFS=\| a.txt > output.txt output.txt 5|1|2|3|4|6|7|8 e|a|b|c|d|f|g|h The above command is working fine. I am... (4 Replies)
Discussion started by: i150371485
4 Replies

10. Solaris

Explain the output of swap -s and swap -l

Hi Solaris Folks :), I need to calculate the swap usage on solaris server, please let me understand the output of below swap -s and swap -l commands. $swap -s total: 1774912k bytes allocated + 240616k reserved = 2015528k used, 14542512k available $swap -l swapfile dev swaplo... (6 Replies)
Discussion started by: seenuvasan1985
6 Replies
CGI::FormBuilder::Template::Text(3pm)			User Contributed Perl Documentation		     CGI::FormBuilder::Template::Text(3pm)

NAME
CGI::FormBuilder::Template::Text - FormBuilder interface to Text::Template SYNOPSIS
my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form', } ); DESCRIPTION
This engine adapts FormBuilder to use "Text::Template". Usage is very similar to Template Toolkit: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', # use Text::Template template => 'form.tmpl', } ); The default options passed into "Text::Template->new()" with this calling form are: TYPE => 'FILE' SOURCE => 'form.tmpl' DELIMITERS => ['<%','%>'] As these params are passed for you, your template will look very similar to ones used by Template Toolkit and "HTML::Mason" (the Text::Template default delimiters are "{" and "}", but using alternative delimiters speeds it up by about 25%, and the "<%" and "%>" delimiters are good, familiar-looking alternatives). The following methods are provided (usually only used internally): engine Returns a reference to the "Text::Template" object prepare Returns a hash of all the fields ready to be rendered. render Uses the prepared hash and expands the template, returning a string of HTML. TEMPLATES
<% $jshead %> - JavaScript to stick in <head> <% $title %> - The <title> of the HTML form <% $start %> - Opening <form> tag and internal fields <% $submit %> - The submit button(s) <% $reset %> - The reset button <% $end %> - Closing </form> tag <% $fields %> - List of fields <% $field %> - Hash of fields (for lookup by name) Note that you refer to variables with a preceding "$", just like in Perl. Like Template Toolkit, you can specify a variable to place fields under: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form' }, ); Unlike Template Toolkit, though, these will not be placed in OO-style, dot-separated vars. Instead, a hash will be created which you then reference: <% $form{jshead} %> <% $form{start} %> etc. And field data is in a hash-of-hashrefs format: For a field named... The field data is in... -------------------- ----------------------- job <% $form{field}{job} %] size <% $form{field}{size} %] email <% $form{field}{email} %] Since "Text::Template" looks so much like Perl, you can access individual elements and create variables like so: <% my $myfield = $form{field}{email}; $myfield->{label}; # text label $myfield->{field}; # field input tag $myfield->{value}; # first value $myfield->{values}; # list of all values $myfield->{options}; # list of all options $myfield->{required}; # required flag $myfield->{invalid}; # invalid flag $myfield->{error}; # error string if invalid %> <% for my $field (@{$form{fields}}) { $OUT .= "<tr> <td>" . $field->{label} . "</td> <td>" . $field->{field} . "</td> <tr>"; } %> In addition, when using the engine option, you supply an existing Text::Template object or a hash of parameters to be passed to "new()". For example, you can ask for different delimiters yourself: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', template => 'form.tmpl', variable => 'form', engine => { DELIMITERS => [ '[@--', '--@]' ], }, data => { version => 1.23, author => 'Fred Smith', }, }, ); If you pass a hash of parameters, you can override the "TYPE" and "SOURCE" parameters, as well as any other "Text::Template" options. For example, you can pass in a string template with "TYPE => STRING" instead of loading it from a file. You must specify both "TYPE" and "SOURCE" if doing so. The good news is this is trivial: my $form = CGI::FormBuilder->new( fields => @fields, template => { type => 'Text', variable => 'form', engine => { TYPE => 'STRING', SOURCE => $string, DELIMITERS => [ '[@--', '--@]' ], }, data => { version => 1.23, author => 'Fred Smith', }, }, ); If you get the crazy idea to let users of your application pick the template file (strongly discouraged) and you're getting errors, look at the "Text::Template" documentation for the "UNTAINT" feature. Also, note that "Text::Template"'s "PREPEND => 'use strict;'" option is not recommended due to the dynamic nature for "FormBuilder". If you use it, then you'll have to declare each variable that "FormBuilder" puts into your template with "use vars qw($jshead' ... etc);" If you're really stuck on this, though, a workaround is to say: PREPEND => 'use strict; use vars qw(%form);' and then set the option "variable => 'form'". That way you can have strict Perl without too much hassle, except that your code might be exhausting to look at :-). Things like $form{field}{your_field_name}{field} end up being all over the place, instead of the nicer short forms. Finally, when you use the "data" template option, the keys you specify will be available to the template as regular variables. In the above example, these would be "<% $version %>" and "<% $author %>". And complex datatypes are easy: data => { anArray => [ 1, 2, 3 ], aHash => { orange => 'tangy', chocolate => 'sweet' }, } This becomes the following in your template: <% @anArray; # you can use $myArray[1] etc. %aHash; # you can use $myHash{chocolate} etc. %> For more information, please consult the "Text::Template" documentation. SEE ALSO
CGI::FormBuilder, CGI::FormBuilder::Template, Text::Template REVISION
$Id: Text.pm 100 2007-03-02 18:13:13Z nwiger $ AUTHOR
Copyright (c) Nate Wiger <http://nateware.com>. All Rights Reserved. Text::Template support is due to huge contributions by Jonathan Buhacoff. Thanks man. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. perl v5.14.2 2011-09-16 CGI::FormBuilder::Template::Text(3pm)
All times are GMT -4. The time now is 08:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy