i have a file,like
1 3
4 5
6 7
8 9
i want to save it into an array.
and then i want to get every element, because i want to use them to calculate. for example: i want to calculate 1 + 3.
but i cannot reach my goal.
open (FILE, "<", "number");
my @arr;
while (<FILE>){
chomp;... (1 Reply)
Hi all,
How to:
Run a bash script, display on the screen and save all information in a file including error information.
For example:
I have a bash script called test.sh
now I want to run the test.sh and display the output on the screen and save the output including error info to a file.
... (1 Reply)
I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like,
echo "Runtimes for servlet 4, 100K structures" > test_times.txt
echo "" >> test_times.txt
echo "runs where N=10" >> test_times.txt
echo... (7 Replies)
Hi,
I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column.
For example:
Sample file "file1.txt":
1 name1 a first
2 name2 b second
3 name3 c third
and have arrays such as:
line1 = ( "1" "name1" "a"... (3 Replies)
Hi there.
i have created a program that in the end it will give output like this
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
.............. 17
i wonder how to save the output into a single string and into a file.
i.e 1 10 11 12 9 2 3 8 13 14 7 4 5 6 15 17 (in this order,... (3 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi there.
i have created a program that in the end it will give output like this
1 2 3 4 5
10 9 ... (1 Reply)
I'm working on a script to execute a number of items. One being, editing particular files to add certain lines. I'm attempting to utilize sed, but, having issues when running from a bash script. Assistance is greatly appreciated.
My example:
sed -i '14 i\
# add these lines
add these lines to... (5 Replies)
I am trying to select a file in bash and save it to a directory. The below does run but no selected file is saved. Thank you :).
bash
# select file
printf "please select a file to analyze with entered gene or genes \n"
select file in $(cd... (4 Replies)
#!/bin/bash
X=(2H 4S 10D QC JD 9H 8S)
How do I unset the 10D from this array and save it to a file?
Please use CODE tags as required by forum rules! (5 Replies)
Discussion started by: cogiz
5 Replies
LEARN ABOUT DEBIAN
bind::config::parser
BIND::Config::Parser(3pm) User Contributed Perl Documentation BIND::Config::Parser(3pm)NAME
BIND::Config::Parser - Parse BIND Config file.
SYNOPSIS
use BIND::Config::Parser;
# Create the parser
my $parser = new BIND::Config::Parser;
my $indent = 0;
# Set up callback handlers
$parser->set_open_block_handler( sub {
print " " x $indent, join( " ", @_ ), " {
";
$indent++;
} );
$parser->set_close_block_handler( sub {
$indent--;
print " " x $indent, "};
";
} );
$parser->set_statement_handler( sub {
print " " x $indent, join( " ", @_ ), ";
";
} );
# Parse the file
$parser->parse_file( "named.conf" );
DESCRIPTION
BIND::Config::Parser provides a lightweight parser to the configuration file syntax of BIND v8 and v9 using a "Parse::RecDescent" grammar.
It is in a similar vein to "BIND::Conf_Parser". However, as it has no knowledge of the directives, it doesn't need to be kept updated as
new directives are added, it simply knows how to carve up a BIND configuration file into logical chunks.
CONSTRUCTOR
new( );
Create a new "BIND::Config::Parser" object.
METHODS
set_open_block_handler( CODE_REF );
Set the code to be called when a configuration block is opened. At least one argument will be passed; the name of that block, for
example "options" or "zone", etc. as well as any additional items up to but not including the opening curly brace.
set_close_block_handler( CODE_REF );
Set the code to be called when a configuration block is closed. No arguments are passed.
set_statement_handler( CODE_REF );
Set the code to be called on a single line configuration element. At least one argument will be passed; the name of that element, as
well as any additional items up to but not including the ending semi-colon.
parse_file( FILENAME );
Parse FILENAME, triggering the above defined handlers on the relevant sections.
TODO
Probably the odd one or two things. I'm fairly sure the grammar is correct.
COPYRIGHT AND LICENSE
Copyright (c) 2005 Matt Dainty.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHORS
Matt Dainty <matt@bodgit-n-scarper.com>.
SEE ALSO
perl, Parse::RecDescent, BIND::Conf_Parser.
perl v5.14.2 2005-06-26 BIND::Config::Parser(3pm)