hello
A small shell scripting help..
I have a file say with 5 lines of text (text file).
At the end of everyline I need to add a comma at the end of the file.
Thanks, ST2000 (4 Replies)
Hi,
Does anyone know if its possible to add something like an end of line like c or java in unix?
dirs=/home/nosnam
var=''
for dir in $dirs
do
listDirs=`ls -d1 $dir/*`
for eachList in $listDirs
do
listRepos=`du -ks $eachList | awk '{ x+=$1 }; END { print x... (4 Replies)
Hi guys i am new to shell scripting. I wrote this script that simply searches a column value of file1 from file2.
please look at the code below:
awk '
FILENAME==ARGV { file_1_data=$0; next }
FILENAME==ARGV { file_2_data=substr($3,1,12); next }
END { ... (5 Replies)
How do I access one of the indices in array tst with the code below?
tst=sprintf("%5.2f",Car / 12)
When I scan thru the array with
for ( i in tst ) { print i,tst }
I get the output of:
vec-7 144
But when I try this in the END
print tst
It looks like it's not set.
What am... (6 Replies)
Hi,
I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this?
when I use command
echo "1\n" > a.txt
and
od -c a.txt
0000000 1 \n \n
0000003
How does it differentiate \n and eof in this case?
Regards,
Venkat (1 Reply)
Hi Folks,
Using the Vi, how can I add a numbers at the end of the line.
For eg: I have the numbers in the file as:
58.125.33
22.58.68
25.144.225
114.25.38
I need to add .0/8 at the end of all the line. So, it should be like
58.125.33.0/8
22.58.68.0/8
25.144.225.0/8
114.25.38.0/8 (6 Replies)
hi,
i have file which is having large sql query
eg :
i am executing this sql file but now i want to add ; after query on same line
i.e. i should look like
any idea how to achieve it ? (6 Replies)
How to add a comma at the end of each line in this file?30 1412
30 3352
30 5254
30 5543
30 7478
3 28
3 30
3 39
3 54
3 108
3 152
3 178
3 182
3 214
3 271
3 286
3 300
3 348
3 349
3 371 (3 Replies)
i want to add a white-space at the end of each line for my inp.file, but when i do it, the result is a new line with a white-space between each line!
my input:
2012 0811 1223 15.2 L 38.393 46.806 9.0 Teh 78 0.5 6.5LTeh 1
GAP=74 ... (5 Replies)
Seems simple but ive been searching for a good hour of so
I have a text file and would like to add a string to the end of line 5 ( as an example)
to ake tings hard the line number we have to add the text to is stored in a variable cunningly name $Line_to_append
any ideas on how this could... (2 Replies)
Discussion started by: dunryc
2 Replies
LEARN ABOUT DEBIAN
object::declare
Object::Declare(3pm) User Contributed Perl Documentation Object::Declare(3pm)NAME
Object::Declare - Declarative object constructor
SYNOPSIS
use Object::Declare ['MyApp::Column', 'MyApp::Param'];
my %objects = declare {
param foo =>
!is global,
is immutable,
valid_values are qw( more values );
column bar =>
field1 is 'value',
field2 is 'some_other_value',
sub_params are param( is happy ), param ( is sad );
};
print $objects{foo}; # a MyApp::Param object
print $objects{bar}; # a MyApp::Column object
# Assuming that MyApp::Column::new simply blesses into a hash...
print $objects{bar}{sub_params}[0]; # a MyApp::Param object
print $objects{bar}{sub_params}[1]; # a MyApp::Param object
DESCRIPTION
This module exports one function, "declare", for building named objects with a declarative syntax, similar to how Jifty::DBI::Schema
defines its columns.
In list context, "declare" returns a list of name/object pairs in the order of declaration (allowing duplicates), suitable for putting into
a hash. In scalar context, "declare" returns a hash reference.
Using a flexible "import" interface, one can change exported helper functions names (declarator), words to link labels and values together
(copula), and the table of named classes to declare (mapping):
use Object::Declare
declarator => ['declare'], # list of declarators
copula => { # list of words, or a map
is => '', # from copula to label prefixes,
are => '', # or to callback that e.g. turns
has => sub { has => @_ }, # "has X" to "has is X" and
# "X has 1" to "has is [X => 1]"
},
aliases => { # list of label aliases:
more => 'less', # turns "is more" into "is less"
# and "more is 1" into "less is 1"
},
mapping => {
column => 'MyApp::Column', # class name to call ->new to
param => sub { # arbitrary coderef also works
bless(@_, 'MyApp::Param');
},
};
After the declarator block finishes execution, all helper functions are removed from the package. Same-named functions (such as &is and
&are) that existed before the declarator's execution are restored correctly.
NOTES
If you export the declarator to another package via @EXPORT, be sure to export all mapping keys as well. For example, this will work for
the example above:
our @EXPORT = qw( declare column param );
But this will not:
our @EXPORT = qw( declare );
The copula are not turned into functions, so there is no need to export them.
AUTHORS
Audrey Tang <cpan@audreyt.org>
COPYRIGHT
Copyright 2006, 2007 by Audrey Tang <cpan@audreyt.org>.
This software is released under the MIT license cited below.
The "MIT" License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
perl v5.10.0 2007-01-27 Object::Declare(3pm)