12-07-2012
So, any line beginning with '>NM_[0-9]\(8\)' needs a nm lookup and a sym lookup and a :sym insertion. What if the nm or sym lookup fails? sed could help parse, but you are writing the output file in shell, and usually speed precludes any command fork/exec per line is a shell data processing loop for non-trivial amounts of data (must use shell built-in commands or one command per file). You can use one sed for all files to break your nm number out into a separate field for a "while read prefix nm rest ; do ... ; done" loop, and if prefix is '>NM_' then lookup sym and make a new line else preserve old line 'echo "$prefix$nm$rest" '.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have two comma separated value(CSV) files, say FileA and FileB.
The contents looks like that shown below.
FileA
EmpNo,Name,Age,Sex,
1000,ABC,23,M,
1001,DES,24,F, ... (2 Replies)
Discussion started by: ultimate
2 Replies
2. Shell Programming and Scripting
Hey All
Can any one please suggest the procedure to search a part of line in a very large file in which log entries are entered with very high speed.
i have trued with grep and egrep
grep 'text text text' <file-name>
egrep 'text text text' <file-name>
here 'text text text' is... (4 Replies)
Discussion started by: NIMISH AGARWAL
4 Replies
3. Shell Programming and Scripting
I have two files as Count1 and Count2. The count contains only one values as 10 and count2 contains only one
values as 20. Now I want third file Count3 as count1+Count2. That is it should contain sum of two file(10+20=30) (3 Replies)
Discussion started by: Shell_Learner
3 Replies
4. Shell Programming and Scripting
I've used awk for some simple scripting, but having trouble figuring out how to search a couple of data files that have Name/Address/Zip Codes from another file that has list of only Zip Codes, and write out the lines that matched.
Zip code field in the data file is 27
I was thinking... (5 Replies)
Discussion started by: matkins99
5 Replies
5. Shell Programming and Scripting
awk 'BEGIN{IGNORECASE=1} /error|warning|exception/ { ++x } END { print x }' filename
The above command returning the number of times the pattern present in the file. But I want the the line number as well. please help me out (6 Replies)
Discussion started by: arukuku
6 Replies
6. Shell Programming and Scripting
Hello Everyone,
I need a help from experts of this community regarding one of the issue that I am facing with shell scripting.
My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line.
The... (20 Replies)
Discussion started by: Sourav Das
20 Replies
7. Shell Programming and Scripting
Hi,
I am having a file in the following format.
for aaaa
1111 1234
2222 3434
for bbbb
1111 3434.343
2222 2343
for cccc
3333 2343.343
4444 89000
for dddd
1111 5678.343
2222 890.3
aaaa 2343.343
bbbb 34343.343 (5 Replies)
Discussion started by: jpkumar10
5 Replies
8. Shell Programming and Scripting
Hi guys.
I'm trying to do a search on the fruit & brand inside Fruit.txt, and printing the result out in the following format:
, , $,
I am able to do this via the following code:
awk -F: -vOFS=", " -vt="$Fruit:$Brand" '$0~t{$3="$"$3;print}' Fruit.txt
However, I want to be able to... (5 Replies)
Discussion started by: todaealas
5 Replies
9. Shell Programming and Scripting
Hi All,
please suggest me..
How to add the text from one file to another file and need to add the code after 3 lines of below searched line .
sample code in standard file:
<corecom:Description xml:id="id_2607">
<xsl:value-of... (6 Replies)
Discussion started by: vijayko
6 Replies
10. Shell Programming and Scripting
I have a shell script that looks something like the following:
mysql -uroot db1 < db1.sql
mysql -uroot db2 < db2.sql
mysql -uroot db3 < db3.sql
mysql -uroot db4 < db4.sql
....
different db names in more than 160 lines.
I want to run this script with nohup and have a status later.
So,... (6 Replies)
Discussion started by: MKH
6 Replies
LEARN ABOUT PHP
array_intersect
ARRAY_INTERSECT(3) 1 ARRAY_INTERSECT(3)
array_intersect - Computes the intersection of arrays
SYNOPSIS
array array_intersect (array $array1, array $array2, [array $...])
DESCRIPTION
array_intersect(3) returns an array containing all the values of $array1 that are present in all the arguments. Note that keys are pre-
served.
PARAMETERS
o $array1
- The array with master values to check.
o $array2
- An array to compare values against.
o $...
- A variable list of arrays to compare.
RETURN VALUES
Returns an array containing all of the values in $array1 whose values exist in all of the parameters.
EXAMPLES
Example #1
array_intersect(3) example
<?php
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>
The above example will output:
Array
(
[a] => green
[0] => red
)
NOTES
Note
Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is
the same.
SEE ALSO
array_intersect_assoc(3), array_diff(3), array_diff_assoc(3).
PHP Documentation Group ARRAY_INTERSECT(3)