Sponsored Content
Full Discussion: Bash array manipulation
Top Forums Shell Programming and Scripting Bash array manipulation Post 302756519 by RudiC on Wednesday 16th of January 2013 03:58:24 AM
Old 01-16-2013
From the man pages in this forum:
Quote:
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] -e pattern_list... [-f pattern_file]... [file]...

-f pattern_file Reads one or more patterns from the file named by the path name pattern_file. Patterns in pattern_file are terminated by a NEWLINE character. . . .
Watch out - there's two greps in solaris!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash file manipulation help

Hello, I'm writing a bash script and I have a question. Here's what I'm doing: I have a file called inv.dat which contains the following: B102:Action Figure - Teacher:79 B103:Bike - Purple:23 B104:Baseball:25 B105:Cricket Bat:15 B101:Action Figure - Fireman:15 B100:Flame-Thrower:25 ... (2 Replies)
Discussion started by: netmaster
2 Replies

2. Shell Programming and Scripting

Array manipulation in perl

hi all, i am trying to append the output of a find command (for different paths)in an array as below... my $res_array; $i=0; $dir="/orn/ops/regs"; foreach $block("am","xb"){ $bdir="$dir/$block"; $res_array=`find $bdir ! -user mainuser -printf \"\%u \%h\\n\"`; $i++; } i... (6 Replies)
Discussion started by: saapa
6 Replies

3. Shell Programming and Scripting

bash, help with stdout manipulation.

Hey all, Im kind of lost on how to do what I want so I figured I would ask. I want to pipe STDOUT of an app to a log file, but I want to prepend each line of that output with the date and time. Im drawing a complete blank on how to do this?? Any ideas? i.e. output is currently this:... (9 Replies)
Discussion started by: trey85stang
9 Replies

4. Shell Programming and Scripting

AWK manipulation in bash script

EDIT: This has been SOLVED. Thanks! Greetings everyone, I've posted a few threads with some quick help questions, and this is another one of those. I can't post enough gratitude for those much more knowledgeable than myself who are willing to give good advice for my minor issues. Now,... (2 Replies)
Discussion started by: Eblue562
2 Replies

5. Shell Programming and Scripting

bash string manipulation

Hello guys, here is my problem: I got a shell script which is called by an external piece of software, the external software is not under my control. The software passes data as an argument to my script like ./bla.sh 'service;1234567890;ok;hostname;some text here' I need to pass the... (3 Replies)
Discussion started by: snoogie
3 Replies

6. Shell Programming and Scripting

Bash string manipulation

In my script I'm retrieving a parameter through an API call. I need to trim some things out of the result so I can use it as a parameter to pass to another process. I've got it working but it's pretty kludgy and I'm hoping someone can help me with a better way. This is the code that retrieves... (2 Replies)
Discussion started by: withanh
2 Replies

7. Shell Programming and Scripting

Bash - file manipulation

I need to change a file like this: John Smith;http://www.profile1.com John Smith;http://www.profile2.com Frank Olsen;http://www.profile3.com Frank Olsen;http://www.profile4.com Into: John Smith;http://www.profile1.com;http://www.profile2.com Frank... (2 Replies)
Discussion started by: locoroco
2 Replies

8. 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

9. Shell Programming and Scripting

Array manipulation with awk?

Dear friends, I'm wondering if we could do some simple math on two arrays with the same size? a1 Fe -0.21886700 -0.01417600 -0.24390300 C 2.20529400 0.89434100 -0.61061000 C -1.89657700 -0.74793000 -0.07778200 C ... (8 Replies)
Discussion started by: liuzhencc
8 Replies

10. Shell Programming and Scripting

Bash arrays: rebin/interpolate smaller array to large array

hello, i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N. for case 1, I want to stretch N to fit M arrayHuge H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
ARRAY_INTERSECT_UASSOC(3)						 1						 ARRAY_INTERSECT_UASSOC(3)

array_intersect_uassoc - Computes the intersection of arrays with additional index check, compares indexes by a callback function

SYNOPSIS
array array_intersect_uassoc (array $array1, array $array2, [array $...], callable $key_compare_func) DESCRIPTION
array_intersect_uassoc(3) returns an array containing all the values of $array1 that are present in all the arguments. Note that the keys are used in the comparison unlike in array_intersect(3). PARAMETERS
o $array1 - Initial array for comparison of the arrays. o $array2 - First array to compare keys against. o $... - Variable list of array arguments to compare values against. o $key_compare_func - The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. int callback (mixed $a, mixed $b) RETURN VALUES
Returns the values of $array1 whose values exist in all of the arguments. EXAMPLES
Example #1 array_intersect_uassoc(3) example <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red"); print_r(array_intersect_uassoc($array1, $array2, "strcasecmp")); ?> The above example will output: Array ( [b] => brown ) SEE ALSO
array_intersect(3), array_intersect_assoc(3), array_uintersect_assoc(3), array_uintersect_uassoc(3), array_intersect_key(3), array_inter- sect_ukey(3). PHP Documentation Group ARRAY_INTERSECT_UASSOC(3)
All times are GMT -4. The time now is 03:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy