12-31-2011
Searching for Multiple texts in a file
Hello guys,
I hope anyone can help me with this ...
I have a file in which i have around 6000 lines of same format text like
1234567
2345678
3456789
....................
Now what I have to do is that there I have to search these numbers in another file which contains hundreds of thousands of records...
How can I search these numbers one by one and if found in that file print it to another output file.
Please help me with this problem.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I... (6 Replies)
Discussion started by: Anahka
6 Replies
2. UNIX for Advanced & Expert Users
Please help. Here is my problem. I have 9000 lines in file a and 500,000 lines in file b. For each line in file a I need to search file b and remove that line. I am currently using the grep -v command and loading the output into a new file. However, because of the size of file b this takes an... (2 Replies)
Discussion started by: mjs3221
2 Replies
3. Shell Programming and Scripting
This is the problem actually:
This regex:
egrep "low debug.*\".*\"" $dbDir/alarmNotification.log
is looking for data between the two quotation marks:
".*\"
When I hate data like this:
low debug 2009/3/9 8:30:20.47 ICSNotificationAlarm Prodics01ics0003 IC... (0 Replies)
Discussion started by: ndedhia1
0 Replies
4. Shell Programming and Scripting
I have a server and occasionally the file mysqld.log would show something like
/usr/libexec/mysqld: Disk is full writing './example_com_-_wordpress/wp_statpress.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs
How do I write a simple shell script to check mysqld.log... (1 Reply)
Discussion started by: acider
1 Replies
5. Shell Programming and Scripting
I am trying to find a way to utilise the full potential of my cpu cores and memory on my windows machine.
Now, I am quite familiar with grep, however, running a Unix based OS is not an option right now.
Unfortunately, the 32 bit grep for windows that I am running, I cannot run multiple... (1 Reply)
Discussion started by: Moloch
1 Replies
6. Shell Programming and Scripting
Hi All,
I have a file in which i have to search for a pattern from the beginning of the file and if the pattern is found , then i have to perform a reverse search from that line to the beginning of the file to get the first occurrence of another pattern.
sample input file
hey
what are you... (8 Replies)
Discussion started by: Kesavan
8 Replies
7. Shell Programming and Scripting
I use this command to find a search (Nr of active alarms are) and print one line before and 10 lines after the search keywords.
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=1 a=10 s="Nr of active alarms are:" *.log
However, I would like to know how to tell it to print... (3 Replies)
Discussion started by: tthach830
3 Replies
8. Shell Programming and Scripting
Hi Gurus,
i have 8 zipped files and each file is having more than 100,000 records or more.
issue :-
i want to search the missing text from each zipped files
i have stuck here, the below command works fine if i give the value 10 for the deptno.
if i have more than 1 records... (6 Replies)
Discussion started by: SeenuGuddu
6 Replies
9. Shell Programming and Scripting
Hi all,
I've the following hostnames & ip addresses saved in host_ip.txt
Based on this list, I need to create the following script.
where by HH is a hostname
and XXXX is an ip address
So the final output would be something like this.
Currently, I'm doing it manually, replace, copy... (3 Replies)
Discussion started by: type8code0
3 Replies
10. Shell Programming and Scripting
Hi,
I want a help in this forum for my below issue.
1. I have a file where I'm searching for a text .
2. When I get the line where the above string is present I want to cut
some texts from the line where the particular string was found.
These above two steps will repeat in the... (2 Replies)
Discussion started by: bhaski2012
2 Replies
LEARN ABOUT PHP
numfmt_set_text_attribute
NUMFMT_SET_TEXT_ATTRIBUTE(3) 1 NUMFMT_SET_TEXT_ATTRIBUTE(3)
NumberFormatter::setTextAttribute - Set a text attribute
Object oriented style
SYNOPSIS
public bool NumberFormatter::setTextAttribute (int $attr, string $value)
DESCRIPTION
Procedural style
bool numfmt_set_text_attribute (NumberFormatter $fmt, int $attr, string $value)
Set a text attribute associated with the formatter. An example of a text attribute is the suffix for positive numbers. If the formatter
does not understand the attribute, U_UNSUPPORTED_ERROR error is produced. Rule-based formatters only understand NumberFormat-
ter::DEFAULT_RULESET and NumberFormatter::PUBLIC_RULESETS.
PARAMETERS
o $fmt
-NumberFormatter object.
o $attr
- Attribute specifier - one of the text attribute constants.
o $value
- Text for the attribute value.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
numfmt_set_text_attribute(3) example
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)."
";
echo numfmt_format($fmt, -1234567.891234567890000)."
";
numfmt_set_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX, "MINUS");
echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)."
";
echo numfmt_format($fmt, -1234567.891234567890000)."
";
?>
Example #2
OO example
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)."
";
echo $fmt->format(-1234567.891234567890000)."
";
$fmt->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, "MINUS");
echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)."
";
echo $fmt->format(-1234567.891234567890000)."
";
?>
The above example will output:
Prefix: -
-1.234.567,891
Prefix: MINUS
MINUS1.234.567,891
SEE ALSO
numfmt_get_error_code(3), numfmt_get_text_attribute(3), numfmt_set_attribute(3).
PHP Documentation Group NUMFMT_SET_TEXT_ATTRIBUTE(3)