Sponsored Content
Full Discussion: concatinating the array
Top Forums Shell Programming and Scripting concatinating the array Post 302313907 by durden_tyler on Thursday 7th of May 2009 01:01:37 AM
Old 05-07-2009
Code:
$
$ perl -e '{
>   @a = qw/a b c/; print "Array a =\n",join("\n",@a),"\n";
>   @b = qw/1 2 3/; print "Array b =\n",join("\n",@b),"\n";
>   foreach $i (0..$#a){ $c[$i] = $a[$i].$b[$i]; } print "Array c = \n",join("\n",@c),"\n";}'
Array a =
a
b
c
Array b =
1
2
3
Array c =
a1
b2
c3
$

tyler_durden

________________________________________________
"Without pain, without sacrifice, we would have nothing."
 

10 More Discussions You Might Find Interesting

1. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies

2. AIX

Concatinating line by line from one file to other

Hi, I want to insert data from one file to another file. My requirement goes this way: I have a file1 with data as: 12345 43534 56678 23545 12343 and so on... I have a file2 with data as: name1:abc:12:9999 name2:ght:1:9999 name3:wrt:17:9999 name3:erc:22:9999 name4:xyz:16:9999 ... (1 Reply)
Discussion started by: me_haroon
1 Replies

3. UNIX for Dummies Questions & Answers

concatinating data

Hi All, I have a file penn.txt which has the following data: hello I wish to append a sting to this file so that data in the file would be represented as: hello%%% Any help on this is greatly appreciated. Thanks KOP. (1 Reply)
Discussion started by: kingofprussia
1 Replies

4. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

5. Shell Programming and Scripting

concatinating the string in each line of the file

how to concatenate particular string in each line of a file.. root$cat conf check_11043 heartbeat_4345 ---------- if i want to add the string "done" output of the file should be check_11043 done heartbeat_4345 done (1 Reply)
Discussion started by: mail2sant
1 Replies

6. Shell Programming and Scripting

Problem when concatinating wildcard onto file location in bash script

I am having difficulty with the following script: #! /bin/bash filelist=~/data/${1}* ~/./convertFile $filelist ~/temp/outputEssentially, there are a large number of files in the directory ~/data, each with a four-letter code at the beginning (eg. aaaa001 aaaa002 bbbb001 bbbb002 etc). The... (11 Replies)
Discussion started by: Lears_Fool
11 Replies

7. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

8. Shell Programming and Scripting

Concatinating the lines based on number of delimiters

Hi, I have a problem to concatenate the lines based on number of delimiters (if the delimiter count is 9 then concatenate all the fields & remove the new line char bw delimiters and then write the following data into second line) in a file. my input file content is Title| ID| Owner|... (4 Replies)
Discussion started by: bi.infa
4 Replies

9. Shell Programming and Scripting

Help with concatinating the data of 2 files

Hi All, I am trying to merge to 2 files 348.csv & 349.csv using join,awk commands but not getting proper output: cat 348.csv Timestamp Server 348 02/04/2013 09:19 100 02/04/2013 09:20 250 02/04/2013 09:21 80 cat... (9 Replies)
Discussion started by: ss_ss
9 Replies

10. Shell Programming and Scripting

Bash 3.2 - Array / Regex - IF 3rd member in array ends in 5 digits then do somthing...

Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help. pesudo code if == ENDSINFIVEINTS ]]; then do... (4 Replies)
Discussion started by: briandanielz
4 Replies
MooseX::AttributeHelpers::Collection::Array(3pm)	User Contributed Perl Documentation	  MooseX::AttributeHelpers::Collection::Array(3pm)

NAME
MooseX::AttributeHelpers::Collection::Array - array attribute type SYNOPSIS
package Stuff; use Moose; use MooseX::AttributeHelpers; has 'options' => ( metaclass => 'Collection::Array', is => 'ro', isa => 'ArrayRef[Int]', default => sub { [] }, provides => { 'push' => 'add_options', 'pop' => 'remove_last_option', } ); DESCRIPTION
This module provides an Array attribute which provides a number of array operations. See MooseX::AttributeHelpers::MethodProvider::Array for more details. METHODS
meta method_provider has_method_provider helper_type BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::Collection::Array(3pm)
All times are GMT -4. The time now is 05:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy