Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to search unique occurence in a file? Post 302358886 by akash028 on Monday 5th of October 2009 06:25:07 AM
Old 10-05-2009
How to search unique occurence in a file?

Hi,

I have to search and count unique occurence of DE numbers in bold below in a file which has content like below.
Code:
Proc Tran F-BUY
Item Tkey Q5JV
Item Tsid JTIZ9
Item Tdat 20091001
Item Tset 20091001
Item Tbkr 5
Item Tshs 2
Item Tprc 897.0
Item Tcom 2000.0
Item Tcm1 20091001 05:28-e502157-DE29606619-1
Proc end
Proc Tran F-BUY
Item Tkey FSTCAN
Item Tsid JTIZ9
Item Tdat 20091001
Item Tset 20091001
Item Tbkr 5
Item Tshs 9
Item Tprc 897.0
Item Tcom 9000.0
Item Tcm1 20090930 15:45-e502157-DE29606620-1
Proc end
Proc Tran F-BUY
Item Tkey 148126
Item Tsid JTIZ9
Item Tdat 20091001
Item Tset 20091001
Item Tbkr 5
Item Tshs 5
Item Tprc 897.0
Item Tcom 5000.0
Item Tcm1 20091001 06:20-e502157-DE29606621-1
Proc end
Proc Tran F-BUY
Item Tkey 14813E
Item Tsid JTIZ9
Item Tdat 20091001
Item Tset 20091001
Item Tbkr 5
Item Tshs 2
Item Tprc 897.0
Item Tcom 2000.0
Item Tcm1 20091001 05:46-e502157-DE29606621-1
Proc end

Please help.

Thanks,
Akash

Last edited by pludi; 10-05-2009 at 07:49 AM.. Reason: code tags please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search& count for the occurence of a word

Greetings, I need to search and count all the occurences of a word in all the files in a directory. Any suggestions greatly appreciated. Thanks (1 Reply)
Discussion started by: skoppana
1 Replies

2. Shell Programming and Scripting

Search for all the unique file extension

Greetings to All ... :b: I have one root folder containing different other folders within it. I need to get the list of all different types of file extensions residing in those folders. Could anyone help me providing some shell script? (1 Reply)
Discussion started by: riverside
1 Replies

3. Shell Programming and Scripting

search file between last occurence of 2 strings

I need to extract the last block of /== START OF SQLPLUS ==/ and /== END OF SQLPLUS ==/. The logifle is written to several times in a day using >> to append. I need a solution using grep/sed. logfile looks like this START OF LOGFILE /== START OF SQLPLUS ==/ ERROR /== END OF SQLPLUS... (5 Replies)
Discussion started by: hanton
5 Replies

4. Shell Programming and Scripting

Perl : Search for next occurence of a word in an array

I have an array as follows: Space: ABC Name: def Age: 22 Type: new Name: fgh Age: 34 Type: old Space: XYZ Name: pqr Age: 44 Type: new : : How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

5. Shell Programming and Scripting

How to identify the occurence of a pattern between a unique character?

hi, is it possible to find the number of occurences of a pattern between two paranthesis. for e.g i have a file as below. >>{ >>hi >>GoodMorning >>how are you? >>} >>is it good, >>tell me yes, if it is good In the above file, its clear the occurence of word "Good"... (17 Replies)
Discussion started by: divak
17 Replies

6. Shell Programming and Scripting

Search file for pattern2 starting from occurence of pattern1

Hi folks, I have a file which contains several occurences of 2 different patterns. I need to find out the line of first occurence of pattern2 starting after the position of first occurence of pattern1. example file: aaaa pattern2 bbbb pattern1 ccc pattern2 ddd pattern1 eee pattern2... (9 Replies)
Discussion started by: sameucho
9 Replies

7. UNIX for Dummies Questions & Answers

Search specific pattern in file and return number of occurence

Hi I want to search for a specific pattern in file Say ABC;HELLO_UNIX_WORLD;PQR ABC;HELLO_UNIX_WORLD_IS_NOT_ENOUGH;XYZ ABC;HELLO_UNIX_FORUM;LMN Pattern to search is : "HELLO_UNIX_*****" and not "HELLO_UNIX_***_***_" I mean after "HELLO_UNIX" there can only be one word.In this case... (2 Replies)
Discussion started by: dashing201
2 Replies

8. UNIX for Dummies Questions & Answers

To find the Nth Occurence of Search String

Hi guys, I like to find the Line number of Nth Occurence of a Search string in a file. If possible, if it will land the cursor to that particualar line will be great. Cheers!! (3 Replies)
Discussion started by: mac4rfree
3 Replies

9. Shell Programming and Scripting

Search only the first occurence in shell

Hello I have a configuration file and I want to extract a part of this configuration. Example of configuration: profile toto { bla bla blabla } conftest { toto { myarguements } I try to do a sed command: sed -n '/'toto' {$/,/^}/p' But the result is : profile toto { (6 Replies)
Discussion started by: maverick31
6 Replies

10. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
getitems(1F)							   FMLI Commands						      getitems(1F)

NAME
getitems - returns a list of currently marked menu items SYNOPSIS
getitems [delimiter_string] DESCRIPTION
The getitems function returns the value of lininfo if defined, else it returns the value of the name descriptor, for all currently marked menu items. Each value in the list is delimited by delimiter_string. The default value of delimiter_string is newline. EXAMPLES
Example 1 A sample output of getitems command. The done descriptor in the following menu definition file executes getitems when the user presses ENTER (note that the menu is multise- lect): Menu="Example" multiselect=TRUE done=`getitems ":" | message` name="Item 1" action=`message "You selected item 1"` name="Item 2" lininfo="This is item 2" action=`message "You selected item 2"` name="Item 3" action=`message "You selected item 3"` If a user marked all three items in this menu, pressing ENTER would cause the following string to be displayed on the message line: Item 1:This is item 2:Item 3 NOTES
Because lininfo is defined for the second menu item, its value is displayed instead of the value of the name descriptor. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 5 Jul 1990 getitems(1F)
All times are GMT -4. The time now is 12:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy