Sponsored Content
Full Discussion: finding first instance
Top Forums UNIX for Dummies Questions & Answers finding first instance Post 26043 by peter.herlihy on Friday 9th of August 2002 08:05:08 PM
Old 08-09-2002
Well I've found the answer from a colleague ..... so I'll share.....for anyone who's interested.

nawk -F\| ' { if ( $1 != field1|| $2 != field2)
{ print $1 "," $2 "," $3 ; field1 = $1; field2 = $2 }
} ' TMPSERVICE_mappings > SERVICE_mappings
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copy Db Instance

I need to copy my Live Db Instance to my Test Db Instance Can somebody please tell me the easiest way to go about this It is an Informix Database running on HP-UX Thanks (0 Replies)
Discussion started by: cobdeng
0 Replies

2. Linux

OTRS instance

hi frnds here i m trying to configure OTRS instance but i m getting the following error message while runnning through browser. I m writing the following http://192.168.1.55:8080/otrs2/index.pl " #!/usr/bin/perl -w... (7 Replies)
Discussion started by: naik_mit
7 Replies

3. Shell Programming and Scripting

Single Instance

Hi, I have a script. I want only one instance of the script to be running at any point of the time. How can I do it. what would be the exact format of the ps command for doing this. For example the name of my script is "Inst.sh" Thanx in advance (2 Replies)
Discussion started by: sendhil
2 Replies

4. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

5. Shell Programming and Scripting

replace first instance(not first instance in line)

Alright, I think I know what I am doing with sed(which probably means I don't). But I cant figure out how to replace just the first occurance of a string. I have tried sed, ed, and grep but can't seem to figure it out. If you have any suggestions I am open to anything! (3 Replies)
Discussion started by: IronHorse7
3 Replies

6. Shell Programming and Scripting

matching first instance of FS

Hi All, I have a property in a file as: property=value=a If I use FS="=" then I want only first = to be considered as field separator and remaining as value echo -e "property=value=a" | awk -F= '{print $2}' ie my $2 should be value=a Can anyone please help me with this. I need it in... (3 Replies)
Discussion started by: gurukottur
3 Replies

7. Shell Programming and Scripting

What does : do in this instance

Guys please see below functions to return a status depending on user input. Both seem to work the same. The second way has a : line which i can't understand or see in a ksh manual anywhere. Instead of doing the variable change if its empty on this line the first function simply does it on the... (7 Replies)
Discussion started by: lavascript
7 Replies

8. Red Hat

Apache instance

Hi , Maximum How many instances of apache can we run in one box? (2 Replies)
Discussion started by: krish4linux
2 Replies

9. Shell Programming and Scripting

Keep the last instance of the record

Hi All, I have a input file like 1| abc 1| abcd 1| abcde 2| abc 2| abcd 3| abcde I want the output like 1| abcde 2| abcde Any help would be highly appreciated. Thanks in advance. (9 Replies)
Discussion started by: lrkp
9 Replies

10. UNIX for Advanced & Expert Users

Grep the only instance name

Hi, I want to get the only application name from the server. Ex: if i give $ ps -ef | grep bw. It will show all BW process with entire path. It will little confuse to list out the process. Can anyone have syntax to get only the instance name. I need this for be, hawk,ems also. Please... (2 Replies)
Discussion started by: ckchelladurai
2 Replies
COUNT_CHARS(3)								 1							    COUNT_CHARS(3)

count_chars - Return information about characters used in a string

SYNOPSIS
mixed count_chars (string $string, [int $mode]) DESCRIPTION
Counts the number of occurrences of every byte-value (0..255) in $string and returns it in various ways. PARAMETERS
o $string - The examined string. o $mode - See return values. RETURN VALUES
Depending on $modecount_chars(3) returns one of the following: o 0 - an array with the byte-value as key and the frequency of every byte as value. o 1 - same as 0 but only byte-values with a frequency greater than zero are listed. o 2 - same as 0 but only byte-values with a frequency equal to zero are listed. o 3 - a string containing all unique characters is returned. o 4 - a string containing all not used characters is returned. EXAMPLES
Example #1 count_chars(3) example <?php $data = "Two Ts and one F."; foreach (count_chars($data, 1) as $i => $val) { echo "There were $val instance(s) of "" , chr($i) , "" in the string. "; } ?> The above example will output: There were 4 instance(s) of " " in the string. There were 1 instance(s) of "." in the string. There were 1 instance(s) of "F" in the string. There were 2 instance(s) of "T" in the string. There were 1 instance(s) of "a" in the string. There were 1 instance(s) of "d" in the string. There were 1 instance(s) of "e" in the string. There were 2 instance(s) of "n" in the string. There were 2 instance(s) of "o" in the string. There were 1 instance(s) of "s" in the string. There were 1 instance(s) of "w" in the string. SEE ALSO
strpos(3), substr_count(3). PHP Documentation Group COUNT_CHARS(3)
All times are GMT -4. The time now is 09:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy