Sponsored Content
Top Forums Shell Programming and Scripting How to initialize array with a larger number? Post 302406389 by cfajohnson on Monday 22nd of March 2010 06:32:19 PM
Old 03-22-2010
Quote:
Originally Posted by mr_harish80
can you explain me what is the equivalent for set -A arr `grep 'some pattern' filename`
in bash script.

Code:
arr=( $(grep 'some pattern' filename) )

(The same syntax works in ksh93.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

eval, array, number of elements - couldn't get it

I try to get a number of elements in an array, using dynamic array name. I need the array name to be dynamic. The array name is constructed as 'inf_ln_$nmb', where $nmb is a file line number So, say I have the arr 'inf_ln_4': > for (( el=0; el<${#inf_ln_4}; el++ )); do > echo "$el:... (1 Reply)
Discussion started by: alex_5161
1 Replies

2. Shell Programming and Scripting

perl + array and incrementing number

morning guys and gals, I am haveing a problem, a friend helped me out with this script but i dont know how to add incrementing number for each movie in movie.list. this is what i have so far. any assistance would be great. I have removed the GT and LT symbols so you can see what is going on... (5 Replies)
Discussion started by: Optimus_P
5 Replies

3. Shell Programming and Scripting

How to insert the number to an array

Hi I work in ksh88 and have a file which has several "set -A " statements: set -A PNUM_LSTM 2713 4124 2635 270 2529 2259 2214 set -A PNUM_LSTM $* for pn in ${PNUM_LSTM} etc... I need to add another number, lets say 555, to the first line ONLY so only the the first line will be updated... (2 Replies)
Discussion started by: aoussenko
2 Replies

4. Programming

C: Initialize "const" array from the "heap"

Hello, I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Discussion started by: HeavyJ
6 Replies

5. Shell Programming and Scripting

Problem to initialize ksh array when first element includes hyphen

Hi I'm trying to create an array with variable including hyphen but ksh refuses the first element set -A allArgs set +A allArgs ${allArgs} -all set +A allArgs ${allArgs} -date set +A allArgs ${allArgs} test ./test.ksh: -all: bad option(s) It happens only when first element is like... (4 Replies)
Discussion started by: gdan2000
4 Replies

6. Shell Programming and Scripting

Largest number in array. Help!

I need to calculate the biggest number in array size n. Example: Users enter: 1 7 4 9 The biggest number is : 9 Simple but I'm really new on this on Shell/Bash! Anything will be helpful! Thanks! #!/bin/bash printf "\tEnter a list of numbers, with spaces: " read -a ARRAY BIG=$1... (5 Replies)
Discussion started by: Sundown
5 Replies

7. UNIX for Dummies Questions & Answers

Using UNIX Commands with Larger number of Files

Hello Unix Gurus, I am new to Unix so need some help on this. I am using the following commands: 1) mv -f Inputpath/*. outputpath 2) cp Inputpath/*. outputpath 3) rm -rf somepath/* 4) Find Inputpath/*. Now I get the following error with... (18 Replies)
Discussion started by: pchegoor
18 Replies

8. Shell Programming and Scripting

Number of arguments to array - Perl Script

I have the following proc. proc get_add {arg1 arg2 arg3 arg4 arg 5 .. ... arg N } { } i need to count the number of arguments and also i need those arguments stored in an array. please help out ---------- Post updated at 06:33 PM ---------- Previous update was at 05:30 PM ---------- ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

9. Shell Programming and Scripting

Reduce the number of lines by using Array

I have the following code to count the number of how many times the name occurred in one file. The code is working fine and the output is exactly what I want. The problem is the real code has more than 50 names in function listname which cause function name to have more than 50 case ,and function... (14 Replies)
Discussion started by: samsan
14 Replies

10. Shell Programming and Scripting

Issue with the incorrect number of array elements

Hello , I have a file : RestartSession.txt with the below contents : Backup p203pcrw01_OS_Weekly Failed full 10/11/2015 10:00:07 PM 1444572007 10/11/2015 10:26:23 PM 1444573583 0:00 0:26 18.76 1 08 0 0 0 2 2 180668 ... (4 Replies)
Discussion started by: rahul2662
4 Replies
IMAP_HEADERINFO(3)							 1							IMAP_HEADERINFO(3)

imap_headerinfo - Read the header of the message

SYNOPSIS
object imap_headerinfo NULL (resource $imap_stream, int $msg_number, [int $fromlength], [int $subjectlength], [string $defaulthost]) DESCRIPTION
Gets information about the given message number by reading its headers. PARAMETERS
o $ imap_stream -An IMAP stream returned by imap_open(3). o $msg_number - The message number o $fromlength - Number of characters for the fetchfrom property. Must be greater than or equal to zero. o $subjectlength - Number of characters for the fetchsubject property Must be greater than or equal to zero. o $defaulthost - RETURN VALUES
Returns the information in an object with following properties: o toaddress - full to: line, up to 1024 characters o to - an array of objects from the To: line, with the following properties: personal, adl, mailbox, and host o fromaddress - full from: line, up to 1024 characters o from - an array of objects from the From: line, with the following properties: personal, adl, mailbox, and host o ccaddress - full cc: line, up to 1024 characters o cc - an array of objects from the Cc: line, with the following properties: personal, adl, mailbox, and host o bccaddress - full bcc: line, up to 1024 characters o bcc - an array of objects from the Bcc: line, with the following properties: personal, adl, mailbox, and host o reply_toaddress - full Reply-To: line, up to 1024 characters o reply_to - an array of objects from the Reply-To: line, with the following properties: personal, adl, mailbox, and host o senderaddress - full sender: line, up to 1024 characters o sender - an array of objects from the Sender: line, with the following properties: personal, adl, mailbox, and host o return_pathaddress - full Return-Path: line, up to 1024 characters o return_path - an array of objects from the Return-Path: line, with the following properties: personal, adl, mailbox, and host o remail - o date - The message date as found in its headers o Date - Same as date o subject - The message subject o Subject - Same as subject o in_reply_to - o message_id - o newsgroups - o followup_to - o references - o Recent - R if recent and seen, N if recent and not seen, ' ' if not recent. o Unseen - U if not seen AND not recent, ' ' if seen OR not seen and recent o Flagged - F if flagged, ' ' if not flagged o Answered - A if answered, ' ' if unanswered o Deleted - D if deleted, ' ' if not deleted o Draft - X if draft, ' ' if not draft o Msgno - The message number o MailDate - o Size - The message size o udate - mail message date in Unix time o fetchfrom - from line formatted to fit $fromlength characters o fetchsubject - subject line formatted to fit $subjectlength characters SEE ALSO
imap_fetch_overview(3). PHP Documentation Group IMAP_HEADERINFO(3)
All times are GMT -4. The time now is 04:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy